• SalesRed
  • NEWBIE
  • 185 Points
  • Member since 2012

  • Chatter
    Feed
  • 6
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 79
    Questions
  • 101
    Replies
Hi there,

I have built my first trigger handler class, I am quite prouf of myself as I have attempted to do this for a long time now. The only problem is that i do not know how to test it. It passes 69% just from all my old trigger tests, however you need 75% to pass. Please help me get my last 6%. 

Also if you have time I was hoping someone could have a look and tell me how I went at combining my triggers, there are 3 combined I think in total. Thank you for your time.

This is my trigger handler:

public class TransactionTriggerHandler {

private boolean m_isExecuting = True;
private integer BatchSize = 0;
private final static boolean ISUPDATE_TRUE = true;
private final static boolean ISUPDATE_FALSE = false;

public TransactionTriggerHandler (boolean isExecuting, integer size)
{
m_isExecuting = isExecuting;
BatchSize = size;
}
public void onBeforeInsert(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap)
{
List<Commission_Period__c> comperiodlist = [Select Id, Point_Calculation_Period_Start__c, Point_Calculation_Period_End__c, Office__c from Commission_Period__c];
List<Office_Commission__c> officeCommissions = [Select Id, Commission_Period_Start__c, Commission_Period_End__c, Office__c from Office_Commission__c];
List<Account_Status__c> AccSt = new List<Account_Status__c>();
List<Account_Status__c> updatedAccSt = new List<Account_Status__c>();
List<Id> accIds = new List<Id>();
set<Id> traserviceIDset = new set<Id>();

for (Transaction__c Tra : triggerNew)
traserviceIDset.add(Tra.Destiny_Service_No__c);

map<id, service__c> servicesMap = new Map<id, Service__c>([Select id, Service_Name__c, service_type__c from Service__c where id in :traserviceIDset limit 1]);

for (Transaction__c Tra: triggerNew) {
if(Tra.Account__c != null && (Tra.Transaction_Type__c == 'First Payment'||Tra.Transaction_Type__c == 'Refund')) {


accIds.add(Tra.Account__c);
}
}
AccSt = [Select Id,Account_Status__c from Account_Status__c WHERE Account__c in :accIds];
for(Account_Status__c a : AccSt)
{



for (Transaction__c Tra: triggerNew ) {
//First Payment Services
//EPE Only
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Essential Property Education Only' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client' && Tra.Transaction_Type__c == 'First Payment') {
a.Account_Status__c = 'EPE Course Only';
a.EPE_Course_Only__c = date.today();
}
//Adv New Client
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client'&& Tra.Transaction_Type__c == 'First Payment') {
a.Account_Status__c = 'EPE Course: Advantage';
a.EPE_Course_Advantage__c = date.today();
}
//Adv Upgrade from EPE
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Adv Upgrade EPE 1x New'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Adv Upgrade EPE 2x New')) {
a.Account_Status__c = 'Support: Advantage';

}
//IPC New Client
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'First Payment' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client') {
a.Account_Status__c = 'EPE Course: IPC';
a.EPE_Course_IPC__c = date.today();
}
//IPC Upgrade from EPE
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'IPC Upgrade EPE 1x New'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'IPC Upgrade EPE 2x New')) {
a.Account_Status__c = 'Support: IPC';

}
//Momentum Support Standard
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'First Payment' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Standard') {
a.Account_Status__c = 'Support: Momentum';
a.Support_Momentum__c = date.today();
}
//Momentum Support Plus
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus-Free')) {
a.Account_Status__c = 'Support: Momentum Plus';
a.Support_Momentum_Plus__c = date.today();
}



//Refund Services
//EPE Only Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Essential Property Education Only' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund EPE Only';
a.Refund_EPE_Only__c = date.today();
}
//Adv Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund Advantage';
a.Refund_Advantage__c = date.today();


}
//IPC Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund IPC';
a.Refund_IPC__c = date.today();
}

//Refund Momentum Support Standard
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'Refund' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Standard') {
a.Account_Status__c = 'Refund Momentum';
a.Refund_Momentum__c = date.today();
}
//Refund Momentum Support Plus
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'Refund' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus-Free')) {
a.Account_Status__c = 'Refund Momentum Plus';
a.Refund_Momentum_Plus__c= date.today();
}

}
updatedAccSt.add(a);

}
if(updatedAccSt.size()>0)
{
update updatedAccSt;
}

for(Transaction__c tra:triggernew)
{
    for(Commission_Period__c  b:comperiodlist){


if(tra.Date_of_payment__c.addMonths(-2).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(1).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period__c = b.Id;
            
            if(tra.Date_of_payment__c.addMonths(-1).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(2).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period_2__c = b.Id;
            
             if(tra.Date_of_payment__c.tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(3).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period_3__c = b.Id;
   




     }
     
      for(Office_Commission__c OffCom:officeCommissions){
      if(tra.Date_of_payment__c >= OffCom.Commission_Period_Start__c && tra.Date_of_payment__c <= OffCom.Commission_Period_End__c && tra.Office__c == OffCom.Office__c)
            tra.Office_Commission__c = OffCom.Id;
            
            }

}


}

public void OnAfterInsert(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap)
{
/*
//CallAfterInsertMethod1formHere();

//Get the correct email template here
EmailTemplate template = [SELECT Id FROM EmailTemplate WHERE Name = 'Transaction_Receipt'];

Set<Id> accountIds = new Set<Id>();
for (Transaction__c tra : triggerNew) {
accountIds.add(tra.Account__c);
}

List<Account> accounts = [SELECT Id, (SELECT Id, Email FROM Contacts) FROM Account WHERE Id IN :accountIds];
Map<Id, List<Contact>> accountMap = new Map<Id, List<Contact>>();
for (Account acct : accounts) {
List<Contact> contacts = new List<Contact>();
for (Contact c : acct.Contacts) {
contacts.add(c);
}
accountMap.put(acct.Id, contacts);
}

//It's best to make a list of emails to send, so that you can send them all at once at the end, in order to avoid hitting governor limits
List<Messaging.SingleEmailMessage> messages = new List<Messaging.SingleEmailMessage>();

for (Transaction__c tra : triggerNew) {
for (Contact c : accountMap.get(tra.Account__c)) {
if (c.Email != null) {
Messaging.SingleEmailMessage m = new Messaging.SingleEmailMessage();
m.setTemplateId(template.Id);
m.setTargetObjectId(c.Id);
m.setWhatId(tra.Id);
messages.add(m);
}
}
}
Messaging.sendEmail(messages);
*/

}

public void OnBeforeUpdate(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap, map<id,Transaction__c> triggerOldMap)
{
//CallBeforeUpdateMethod1formHere();
//CallBeforeUpdateMethod2formHere();
// Query all the values from the Commision Period






List<Commission_Period__c> comperiodlist = [Select Id, Point_Calculation_Period_Start__c, Point_Calculation_Period_End__c, Office__c from Commission_Period__c];
List<Office_Commission__c> officeCommissions = [Select Id, Commission_Period_Start__c, Commission_Period_End__c, Office__c from Office_Commission__c];


for(Transaction__c tra:triggerNew)
{
for(Commission_Period__c  b:comperiodlist){


if(tra.Date_of_payment__c.addMonths(-2).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(1).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period__c = b.Id;

if(tra.Date_of_payment__c.addMonths(-1).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(2).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period_2__c = b.Id;

if(tra.Date_of_payment__c.tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(3).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period_3__c = b.Id;





}

for(Office_Commission__c OffCom:officeCommissions){
if(tra.Date_of_payment__c >= OffCom.Commission_Period_Start__c && tra.Date_of_payment__c <= OffCom.Commission_Period_End__c && tra.Office__c == OffCom.Office__c)
tra.Office_Commission__c = OffCom.Id;

}

}


}

public void OnAfterUpdate(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap, map<id,Transaction__c> triggerOldMap)
{
//CallAfterUpdateMethod1formHere();
//CallAfterUpdateMethod2formHere();
}

public void OnBeforeDelete(list<Transaction__c> triggerOld, map<id,Transaction__c> triggerOldMap)
{
//CallBeforeDeleteMethod1formHere();
//CallBeforeDeleteMethod2formHere();
}

public void OnAfterDelete(list<Transaction__c> triggerOld, map<id,Transaction__c> triggerOldMap)
{
//CallAfterDeleteMethod1formHere();
//CallAfterDeleteMethod2formHere();
}
}


Hi, I have a command line dataloader job which runs at half past each hour. I need to change it that it only extracts records modifed in the past 1 hour.  I can follow the instructions as per http://stackoverflow.com/questions/13129691/soql-query-that-extracts-data-that-got-updated-in-the-last-x-hours however there is one potential issue with this. When the day changes over at midnight querying for 
LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 9 will not be correct.  Is there a way to get around this potential issue in the SOWL query?

Thanks for your help.
 
Hello,  I have a custom object which has a text field I'd like to be able to search on in Global searches.  When I searched for the particular field value yesterday it did not appear however when I searched for the same value roday a record did appear.   I was wondering, is there a time-delay before a field becomes searchable?  If so, is there a way to make a record/ field immediately searchable?

 Thanks for any suggestions on this.
Hello,

I just thought I'd post a question to confirm something which has come up for discussion and which I did not consider as being a possibility when inserting data.
- I have a client which is inserting data into a custom object via the Standard Soap API and dates they enter are not corresponding to their thoughts on how the data should be entered.  The value is enterering with a value 1 day less than the dates they provide.  The clients timezone is GMT + 8 hours.
- To my understanding the date should enter exactly as it's provided in the XML as it's not a Date/Time field and timezone is irrelevant.
- I've asked the client to provide the SOAP XML in order that I can verify what is provided is different than the final value in SFDC but the client is unable to provide the XML (for some reason debugging cannot be setup for this).
On testing this myself using SOAP UI & changing my SFDC User's timezone  & even changing the time for my own laptop the value I enter in the SOAP request inserts exactly as I enter it without any changes.

I note the following details that issues can occur with dataloader sometimes. I presume it's correct that no impact can occur for dates when inserting via a SOAP request? That dates should just enter exactly as received.

https://help.salesforce.com/HTViewHelpDoc?id=faq_import_general_wrong_date.htm&language=en_US

Thanks for any help clarifying on this.
Hi,  I receive the following error in a test class but have not been able to repeat them in non test running scenarios.

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 301O00000008hM6. 
Contact your administrator for help.: []"

Does anyone know if there could be an issue running flows in test class contexts but not otherwise?

Thanks.
Hi,  I've previously seen in Salesforce Org's an Upload Button on the Flow page (i.e. where flows are creeated,) but the current Org I am working in this button does not seem to exist.  I do not see where I can enable the button either.  My user does have "Force.com Flow User" enabled.  Should there be an "Upload" button avaiable beside the "New Flow" button or has it been removed as a functionality?

Thanks in advance. 
Hi,  I've pulled metadata from a sandbox and noted that when I specify the following for example for documents

<types>
             <members>*</members>
             <name>Document</name>
</types>

Not all documents and folders are retrieved.  Is there a way to specify All documents and their folders should be pulled in the metadata without requiring for example to specify each folder name as follows?

<types> <members>MyDocumentFolder/MyDocumentName</members> <name>Document</name> </types>

Does "*" not work in this case/ Similarly for EmailTemplates, Letterheads and others....

Thanks in advance for any help/suggestions

 
Hello,  

I have a visualforce page which has an apexActionFunciton which returns a PageReference which initiates a file download (the URL returned in the pagereference is a signed URL from an external file system).  What I would ideally like to do is to close my visualforce page once the ActionFunction completes however the onComplete does not execute in the apex:actionFunction  (presumably because the PageReference has caused the execution to leave the Visualforce page).
All I wish to do is to close the Visualforce page on completing the actionFunction,

Does anyone know of the best way this can be achieved?

Thanks in advance for any suggestions.
Hi ,  I have URL's which are referencing files in Amazon S2. THe URL's are too long to store in a URL field therefore I have been storing them in Long Text Area fields.  I would like to display the URL as a clickable URL in a related list on a detail page.   Is it possible to workaround the URL size restrction without having to create a visualforce page for this?  I had thought of using a Formula field either but could not do so with a Long Text Area if requiring to store the URL detail there.

Any thoughts or suggestions on this would be welcomed.

Thanks in advance.
Hello,

I have the following code in an Apex Batch Apex Class.

try{
            return Database.getQueryLocator(query);
        }catch(Exception ex){
            return null;
        }

However I cannot seem to catch an exception if an invalid query is provided. I receive the following error
System.UnexpectedException: Start did not return a valid iterable object..

If I try to catch the System.UnexpectedException I still receive an error.

Should a try/catch not work in this scenario?

Thanks in advance for any help.

Hi,  I have a hierarchial custom setting of which I create an instance of in a test class. I receive an error though when I execute my test class.  The error being.
 "System.InvalidParameterValueException: Invalid SetupOwner for Custom Settings"  

In accessing the custom setting in my Apex class I use the following.
Brokerage__c  brokerage  = Broker__c.getInstance(UserInfo.getOrganizationName());"

The functionality does execute ok however the failute occurs as mentioned in my test class.  Does anyone know I can get around this.  I would have thought the user running the test would exist within the same organisation so it should work.

Any tips or help on this would be appreciated.

Thanks in advance.
Hello,

I have a requirement when adding Opportunity Line Items to an opportunity to pre-populate some of the fields when the opportunity line item screen opens.  I've been looking into this and I came across some posts detailing how certain Salesforce standard pages can have fields pre-populated by providing URL parameters when opening the page.

http://writeforce.blogspot.co.uk/2013/01/prepopulating-fields-using-url-hacking.html
https://success.salesforce.com/answers?id=90630000000ghPqAAI
http://blog.wdcigroup.net/2013/10/salesforce-pre-populate-form-data-in-create-screen/

What I'm not sure of though is if this can be applied when adding opportunity Line Items as the process to do so involves a number of steps.
- Select the opportunity
- Click on Add Business Line Item button
- On this page select the price book if not alreadty selected,  or if already selected click on the product to add to the Opportunity
- On the next page that opens, this is the page I need to prepopulate a field on.   I presume though lots of other fields/parameters have been set though via the previous steps.   The current pageI am on is https://cs17.salesforce.com/oppitm/multilineitem.jsp
Are there parameters I can specifically pass in the URL to this https://cs17.salesforce.com/oppitm/multilineitem.jsp page?  I tried to pass parameters as follows  
https://cs17.salesforce.com/oppitm/multilineitem.jsp?CF00Ng0000000fk1W01uw000000Vntx8=a2Ng00000004snuEAA  but I get an error "Unable to Access Page".
The paraemter I provided "CF00Ng0000000fk1W01uw000000Vntx8"  I obtained as the ID of the field I wish to pre-populate.

Should this be possible what I am trying to do, or is pre-population of fields only possible for cerrain Standard pages?

Any help on this would be very much appreciated.

Thanking you in advance.

Hello,

 

I've come across the following scenario.

- I use a SOQL statement to get a list of records.

- I need to use the ID's from this list for a second subsequent query.  

 

Is there a way of getting all the ID's returned from the first query without looping through/travershing the result list first to get the ID's?

I don't wish to write a second query just to obtain the ID's but wondered could they alone be extracted from the first list without looping through the results?

 

Thanks for your help

Hi,  I have a requirement to do the following.

- In an object I have fields representating the days of the month (therefore up to 31 days).

- In a for loop I have values assigned for some days (possibly not all days of the month)

      The values have field value pairs of (daynumber, myvalue) 

 

       I need to assign the corrrect "myvalue" value to the correct field in my object which relates to the day value.

     .E.g. (10,'12.50')   should be assigned to field "Day_10_Price__c"

 

I know I can do this using a very large if statement (checking for the day and assigning it accordingly)  however this seems a bit too much or silly coding.  Does anyone know of a different way this can be achieved?  I know "Case" and "Switch" do not exist in Apex.

 

Any help or suggestions on this would be appreciated,  otherwise I assume I have to create the huge if statement.

 

Thanks in advance for your help!

 

 

Hi,  I just thought I'd confirm if there are still no workarounds for pointing domains to a secure HTTPS Force.com Site URL?  

Non secure (http) URL's can be pointed to but for secure force.com site URL's this feature was previously not possible.

Domain Management is a new feature recently intriduced but I note no mention of https scenarios.

 

https://help.salesforce.com/HTViewHelpDoc?id=domain_mgmt_overview.htm&language=en_US

 

Is it correct therefore that https://<custom-demain>.secure.force.com will still be required for all HTTPS sites?

 

Thanks in advance for any help on this.

 

 

 

 

Hello,

 

I was wondering.  If I wish to set a specific visualforce page for when maintenance is occuring how can I test this out once I add it without having to wait for a Salesforce Maintenance window?

 

Thanks in advance for any help on this.

Hello,

 

If I have the following node element <MyNodeElement EchoToken="5437596" TimeStamp="2006-02-04T15:06:15-0500" Target="MyOrg" Version="1" SequenceNmbr="123456" xmlns="http://www.myns.org/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 

and in my Apex Code I need to get the full Node element Attributes and Namespaces (without child elements).  Can this be done without having to do something like the following (a for loop to get attributes)

 

for (Integer attributeInt=0; attributeInt<requestTypeNode.getAttributeCount(); attributeInt++){

System.debug('Attribute Name=' + requestTypeNode.getAttributeKeyAt(attributeInt));
System.debug('Attribute Value=' + requestTypeNode.getAttributeKeyNsAt(attributeInt));

}

 

Is there a function I can use to return all attributes and namespaces in the element or do I have to get each attribute/namespace individually using a processs similar to the above?

 

Thanks in advance.

Hi,

 

I wish to have webservice functions which when called I will create a SOAP body which I then return in my response.  If I set the return type to String for my webservice function the stting gets included as CData in a <result> element.

 

E.G.

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/TestSOAPWebserviceFromSites">
<soapenv:Body>
<GetMsgRQResponse>
<result><![CDATA[<soapenv:Body><GetMsgRS><result>Success: Name=My Test</result></GetMsgRS></soapenv:Body>]]></result>
</GetMsgRQResponse>
</soapenv:Body>
</soapenv:Envelope>

 

If I wish to override the SOAP Body generated by Salesforce and instead make it my own generated SOAP body what is the return type I need to use for my function?

 

Thanks in advance for any help.

 

 

 

Hi,

 

I was wondering,  If want to add the following to an XML Node using Dom.XMLNode function how can I do so

 

<MyTestNode xmlns="http://www.testsite.com.org/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TimeStamp="2001-12-17T09:30:47.0Z">

 

DOM.XmlNode testNode = bodyNode.addChildElement('MyTestNode', soapNamespace, '');
testNode.setNamespace('', 'http://www.testsite.com.org/2003/05');
testNode.setNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');

 

I can get <MyTestNode xmlns="http://www.testsite.com.org/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


If I want to ad TimeStamp="" within this without it having a namespace prefix "xmlns" how can I do this?

 

Thanks in advacnce for any help.

Hello,

 

I am trying to set a string vaue in my controller class but I'm finding th following unusual scenario resulting:

- Note I've tried to set my value using an actionFunction and subsequently I'm not trying via a hidden field.

 

- I click on the following button

 

<apex:commandLink styleClass="btn" value="Save Image Order" action="{!changeImageOrder}"/>
<apex:inputHidden value="{!currentImageOrder}" id="theHiddenInput"/>

 

In my controller, for String currentImageOrder the setter is called and prints out the value ok in my debug as follows.

 

public String currentImageOrder{get;set{
          system.debug('in image order set ' + value);
    }
}

 

In funciton "changeImageOrder"  String currentImageOrder is null.

 

public PageReference changeImageOrder(){

      system.debug('in chngorder111 ' + currentImageOrder);

      system.debug('in chngorder222 ' + this.currentImageOrder);

return null;
}

 

 

As the setter is called first should the value not be set when I debug in changeImageOrder?

 

Thanks in advance for any help.

Hi,

 

I have a requirement in a test class to execute a System.Schedule for more than one hour past the current time.  I've tried the following but it's failing to run more than one hour from now. It's as if it runs within the current hour

 

String hourNow = ('' + System.Now()).substring(11,13);
Integer hourNowPlusTwo = Integer.valueof(hourNow) + 2;

Test.startTest();
         String scheduleTime = '1 1 ' + hourNowPlusTwo + ' * * ?';
          System.schedule('Run Cleanup', scheduleTime, CleanupCLass);
Test.stopTest();

 

I'm new to Scheduling.  If I want to edit the above to 2 hours from now then if you know of the changes I need this would be appreciated.

 

Thanks in advance.

Hi,  I receive the following error in a test class but have not been able to repeat them in non test running scenarios.

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 301O00000008hM6. 
Contact your administrator for help.: []"

Does anyone know if there could be an issue running flows in test class contexts but not otherwise?

Thanks.
Hello,

I have a requirement when adding Opportunity Line Items to an opportunity to pre-populate some of the fields when the opportunity line item screen opens.  I've been looking into this and I came across some posts detailing how certain Salesforce standard pages can have fields pre-populated by providing URL parameters when opening the page.

http://writeforce.blogspot.co.uk/2013/01/prepopulating-fields-using-url-hacking.html
https://success.salesforce.com/answers?id=90630000000ghPqAAI
http://blog.wdcigroup.net/2013/10/salesforce-pre-populate-form-data-in-create-screen/

What I'm not sure of though is if this can be applied when adding opportunity Line Items as the process to do so involves a number of steps.
- Select the opportunity
- Click on Add Business Line Item button
- On this page select the price book if not alreadty selected,  or if already selected click on the product to add to the Opportunity
- On the next page that opens, this is the page I need to prepopulate a field on.   I presume though lots of other fields/parameters have been set though via the previous steps.   The current pageI am on is https://cs17.salesforce.com/oppitm/multilineitem.jsp
Are there parameters I can specifically pass in the URL to this https://cs17.salesforce.com/oppitm/multilineitem.jsp page?  I tried to pass parameters as follows  
https://cs17.salesforce.com/oppitm/multilineitem.jsp?CF00Ng0000000fk1W01uw000000Vntx8=a2Ng00000004snuEAA  but I get an error "Unable to Access Page".
The paraemter I provided "CF00Ng0000000fk1W01uw000000Vntx8"  I obtained as the ID of the field I wish to pre-populate.

Should this be possible what I am trying to do, or is pre-population of fields only possible for cerrain Standard pages?

Any help on this would be very much appreciated.

Thanking you in advance.

Hi,   I came across the following functuon for generating a random password.  I require that the password is alphanumeric.

 

I note the function does seem to return alphanumeric characters.  Does this seem correct or is it just a coincidence in the passwords I've generated so far?   I need to confirm if alphanumeric will always be returned. If so, what is the logic (explanation) for it?

 

public String generator(Integer len){
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
return key.substring(0,len);
}

 

Thanks in advance for any help!

Hi, I have a command line dataloader job which runs at half past each hour. I need to change it that it only extracts records modifed in the past 1 hour.  I can follow the instructions as per http://stackoverflow.com/questions/13129691/soql-query-that-extracts-data-that-got-updated-in-the-last-x-hours however there is one potential issue with this. When the day changes over at midnight querying for 
LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 9 will not be correct.  Is there a way to get around this potential issue in the SOWL query?

Thanks for your help.
 
Hello,  I have a custom object which has a text field I'd like to be able to search on in Global searches.  When I searched for the particular field value yesterday it did not appear however when I searched for the same value roday a record did appear.   I was wondering, is there a time-delay before a field becomes searchable?  If so, is there a way to make a record/ field immediately searchable?

 Thanks for any suggestions on this.
Hello,

I just thought I'd post a question to confirm something which has come up for discussion and which I did not consider as being a possibility when inserting data.
- I have a client which is inserting data into a custom object via the Standard Soap API and dates they enter are not corresponding to their thoughts on how the data should be entered.  The value is enterering with a value 1 day less than the dates they provide.  The clients timezone is GMT + 8 hours.
- To my understanding the date should enter exactly as it's provided in the XML as it's not a Date/Time field and timezone is irrelevant.
- I've asked the client to provide the SOAP XML in order that I can verify what is provided is different than the final value in SFDC but the client is unable to provide the XML (for some reason debugging cannot be setup for this).
On testing this myself using SOAP UI & changing my SFDC User's timezone  & even changing the time for my own laptop the value I enter in the SOAP request inserts exactly as I enter it without any changes.

I note the following details that issues can occur with dataloader sometimes. I presume it's correct that no impact can occur for dates when inserting via a SOAP request? That dates should just enter exactly as received.

https://help.salesforce.com/HTViewHelpDoc?id=faq_import_general_wrong_date.htm&language=en_US

Thanks for any help clarifying on this.
Hi,  I receive the following error in a test class but have not been able to repeat them in non test running scenarios.

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 301O00000008hM6. 
Contact your administrator for help.: []"

Does anyone know if there could be an issue running flows in test class contexts but not otherwise?

Thanks.
Hi,  I've previously seen in Salesforce Org's an Upload Button on the Flow page (i.e. where flows are creeated,) but the current Org I am working in this button does not seem to exist.  I do not see where I can enable the button either.  My user does have "Force.com Flow User" enabled.  Should there be an "Upload" button avaiable beside the "New Flow" button or has it been removed as a functionality?

Thanks in advance. 
Hello,  

I have a visualforce page which has an apexActionFunciton which returns a PageReference which initiates a file download (the URL returned in the pagereference is a signed URL from an external file system).  What I would ideally like to do is to close my visualforce page once the ActionFunction completes however the onComplete does not execute in the apex:actionFunction  (presumably because the PageReference has caused the execution to leave the Visualforce page).
All I wish to do is to close the Visualforce page on completing the actionFunction,

Does anyone know of the best way this can be achieved?

Thanks in advance for any suggestions.
Hi ,  I have URL's which are referencing files in Amazon S2. THe URL's are too long to store in a URL field therefore I have been storing them in Long Text Area fields.  I would like to display the URL as a clickable URL in a related list on a detail page.   Is it possible to workaround the URL size restrction without having to create a visualforce page for this?  I had thought of using a Formula field either but could not do so with a Long Text Area if requiring to store the URL detail there.

Any thoughts or suggestions on this would be welcomed.

Thanks in advance.
<script type='text/javascript'> 
      var temp12 = 'false';
      if(temp12 == 'true'){
     
         <apex:inputField value="{!task.Chosen_object__c}" required="true" onchange="showObjects()" id="chooseObj"/> <br/>
      
       }
      else{
               <apex:outputField value="{!task.Chosen_object__c}" required="true" onchange="showObjects()" id="chooseObj"/>
      }
    </script>
Hello,

I have the following code in an Apex Batch Apex Class.

try{
            return Database.getQueryLocator(query);
        }catch(Exception ex){
            return null;
        }

However I cannot seem to catch an exception if an invalid query is provided. I receive the following error
System.UnexpectedException: Start did not return a valid iterable object..

If I try to catch the System.UnexpectedException I still receive an error.

Should a try/catch not work in this scenario?

Thanks in advance for any help.

Hi,  I have a hierarchial custom setting of which I create an instance of in a test class. I receive an error though when I execute my test class.  The error being.
 "System.InvalidParameterValueException: Invalid SetupOwner for Custom Settings"  

In accessing the custom setting in my Apex class I use the following.
Brokerage__c  brokerage  = Broker__c.getInstance(UserInfo.getOrganizationName());"

The functionality does execute ok however the failute occurs as mentioned in my test class.  Does anyone know I can get around this.  I would have thought the user running the test would exist within the same organisation so it should work.

Any tips or help on this would be appreciated.

Thanks in advance.
Hi there,

I have built my first trigger handler class, I am quite prouf of myself as I have attempted to do this for a long time now. The only problem is that i do not know how to test it. It passes 69% just from all my old trigger tests, however you need 75% to pass. Please help me get my last 6%. 

Also if you have time I was hoping someone could have a look and tell me how I went at combining my triggers, there are 3 combined I think in total. Thank you for your time.

This is my trigger handler:

public class TransactionTriggerHandler {

private boolean m_isExecuting = True;
private integer BatchSize = 0;
private final static boolean ISUPDATE_TRUE = true;
private final static boolean ISUPDATE_FALSE = false;

public TransactionTriggerHandler (boolean isExecuting, integer size)
{
m_isExecuting = isExecuting;
BatchSize = size;
}
public void onBeforeInsert(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap)
{
List<Commission_Period__c> comperiodlist = [Select Id, Point_Calculation_Period_Start__c, Point_Calculation_Period_End__c, Office__c from Commission_Period__c];
List<Office_Commission__c> officeCommissions = [Select Id, Commission_Period_Start__c, Commission_Period_End__c, Office__c from Office_Commission__c];
List<Account_Status__c> AccSt = new List<Account_Status__c>();
List<Account_Status__c> updatedAccSt = new List<Account_Status__c>();
List<Id> accIds = new List<Id>();
set<Id> traserviceIDset = new set<Id>();

for (Transaction__c Tra : triggerNew)
traserviceIDset.add(Tra.Destiny_Service_No__c);

map<id, service__c> servicesMap = new Map<id, Service__c>([Select id, Service_Name__c, service_type__c from Service__c where id in :traserviceIDset limit 1]);

for (Transaction__c Tra: triggerNew) {
if(Tra.Account__c != null && (Tra.Transaction_Type__c == 'First Payment'||Tra.Transaction_Type__c == 'Refund')) {


accIds.add(Tra.Account__c);
}
}
AccSt = [Select Id,Account_Status__c from Account_Status__c WHERE Account__c in :accIds];
for(Account_Status__c a : AccSt)
{



for (Transaction__c Tra: triggerNew ) {
//First Payment Services
//EPE Only
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Essential Property Education Only' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client' && Tra.Transaction_Type__c == 'First Payment') {
a.Account_Status__c = 'EPE Course Only';
a.EPE_Course_Only__c = date.today();
}
//Adv New Client
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client'&& Tra.Transaction_Type__c == 'First Payment') {
a.Account_Status__c = 'EPE Course: Advantage';
a.EPE_Course_Advantage__c = date.today();
}
//Adv Upgrade from EPE
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Adv Upgrade EPE 1x New'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Adv Upgrade EPE 2x New')) {
a.Account_Status__c = 'Support: Advantage';

}
//IPC New Client
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'First Payment' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'New Client') {
a.Account_Status__c = 'EPE Course: IPC';
a.EPE_Course_IPC__c = date.today();
}
//IPC Upgrade from EPE
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'IPC Upgrade EPE 1x New'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'IPC Upgrade EPE 2x New')) {
a.Account_Status__c = 'Support: IPC';

}
//Momentum Support Standard
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'First Payment' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Standard') {
a.Account_Status__c = 'Support: Momentum';
a.Support_Momentum__c = date.today();
}
//Momentum Support Plus
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'First Payment' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus-Free')) {
a.Account_Status__c = 'Support: Momentum Plus';
a.Support_Momentum_Plus__c = date.today();
}



//Refund Services
//EPE Only Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Essential Property Education Only' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund EPE Only';
a.Refund_EPE_Only__c = date.today();
}
//Adv Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Advantage Program' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund Advantage';
a.Refund_Advantage__c = date.today();


}
//IPC Refund
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Intensive Property Coaching' && Tra.Transaction_Type__c == 'Refund') {
a.Account_Status__c = 'Refund IPC';
a.Refund_IPC__c = date.today();
}

//Refund Momentum Support Standard
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'Refund' && servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Standard') {
a.Account_Status__c = 'Refund Momentum';
a.Refund_Momentum__c = date.today();
}
//Refund Momentum Support Plus
if(servicesMap.get(Tra.Destiny_Service_No__c).Service_Name__c == 'Momentum Support' && Tra.Transaction_Type__c == 'Refund' && (servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus'||servicesMap.get(Tra.Destiny_Service_No__c).Service_Type__c == 'Plus-Free')) {
a.Account_Status__c = 'Refund Momentum Plus';
a.Refund_Momentum_Plus__c= date.today();
}

}
updatedAccSt.add(a);

}
if(updatedAccSt.size()>0)
{
update updatedAccSt;
}

for(Transaction__c tra:triggernew)
{
    for(Commission_Period__c  b:comperiodlist){


if(tra.Date_of_payment__c.addMonths(-2).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(1).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period__c = b.Id;
            
            if(tra.Date_of_payment__c.addMonths(-1).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(2).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period_2__c = b.Id;
            
             if(tra.Date_of_payment__c.tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(3).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
            tra.Commission_Period_3__c = b.Id;
   




     }
     
      for(Office_Commission__c OffCom:officeCommissions){
      if(tra.Date_of_payment__c >= OffCom.Commission_Period_Start__c && tra.Date_of_payment__c <= OffCom.Commission_Period_End__c && tra.Office__c == OffCom.Office__c)
            tra.Office_Commission__c = OffCom.Id;
            
            }

}


}

public void OnAfterInsert(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap)
{
/*
//CallAfterInsertMethod1formHere();

//Get the correct email template here
EmailTemplate template = [SELECT Id FROM EmailTemplate WHERE Name = 'Transaction_Receipt'];

Set<Id> accountIds = new Set<Id>();
for (Transaction__c tra : triggerNew) {
accountIds.add(tra.Account__c);
}

List<Account> accounts = [SELECT Id, (SELECT Id, Email FROM Contacts) FROM Account WHERE Id IN :accountIds];
Map<Id, List<Contact>> accountMap = new Map<Id, List<Contact>>();
for (Account acct : accounts) {
List<Contact> contacts = new List<Contact>();
for (Contact c : acct.Contacts) {
contacts.add(c);
}
accountMap.put(acct.Id, contacts);
}

//It's best to make a list of emails to send, so that you can send them all at once at the end, in order to avoid hitting governor limits
List<Messaging.SingleEmailMessage> messages = new List<Messaging.SingleEmailMessage>();

for (Transaction__c tra : triggerNew) {
for (Contact c : accountMap.get(tra.Account__c)) {
if (c.Email != null) {
Messaging.SingleEmailMessage m = new Messaging.SingleEmailMessage();
m.setTemplateId(template.Id);
m.setTargetObjectId(c.Id);
m.setWhatId(tra.Id);
messages.add(m);
}
}
}
Messaging.sendEmail(messages);
*/

}

public void OnBeforeUpdate(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap, map<id,Transaction__c> triggerOldMap)
{
//CallBeforeUpdateMethod1formHere();
//CallBeforeUpdateMethod2formHere();
// Query all the values from the Commision Period






List<Commission_Period__c> comperiodlist = [Select Id, Point_Calculation_Period_Start__c, Point_Calculation_Period_End__c, Office__c from Commission_Period__c];
List<Office_Commission__c> officeCommissions = [Select Id, Commission_Period_Start__c, Commission_Period_End__c, Office__c from Office_Commission__c];


for(Transaction__c tra:triggerNew)
{
for(Commission_Period__c  b:comperiodlist){


if(tra.Date_of_payment__c.addMonths(-2).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(1).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period__c = b.Id;

if(tra.Date_of_payment__c.addMonths(-1).tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(2).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period_2__c = b.Id;

if(tra.Date_of_payment__c.tostartofmonth() == b.Point_Calculation_Period_Start__c  && tra.Date_of_payment__c.addMonths(3).tostartofmonth().addDays(-1) == b.Point_Calculation_Period_End__c && tra.Office__c == b.Office__c)
tra.Commission_Period_3__c = b.Id;





}

for(Office_Commission__c OffCom:officeCommissions){
if(tra.Date_of_payment__c >= OffCom.Commission_Period_Start__c && tra.Date_of_payment__c <= OffCom.Commission_Period_End__c && tra.Office__c == OffCom.Office__c)
tra.Office_Commission__c = OffCom.Id;

}

}


}

public void OnAfterUpdate(list<Transaction__c> triggerNew, map<id,Transaction__c> triggerNewMap, map<id,Transaction__c> triggerOldMap)
{
//CallAfterUpdateMethod1formHere();
//CallAfterUpdateMethod2formHere();
}

public void OnBeforeDelete(list<Transaction__c> triggerOld, map<id,Transaction__c> triggerOldMap)
{
//CallBeforeDeleteMethod1formHere();
//CallBeforeDeleteMethod2formHere();
}

public void OnAfterDelete(list<Transaction__c> triggerOld, map<id,Transaction__c> triggerOldMap)
{
//CallAfterDeleteMethod1formHere();
//CallAfterDeleteMethod2formHere();
}
}


I created a linline visualforce page for the child and that placed it on Parent obj i.e when a parent record(Like Account) open in bottom then child obj(Like Contact) fields shown and we enter the values and save it this is my vf page...Here my problem is when parent record(Account) is open then in bottom Contact Vf page Account field automatically Created with which account you opened..   when i save then this error is coming

" System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Call2]: [Call2]
Error is in expression '{!Save}' in component <apex:commandButton> in page productrelated "



Here call2__C is parent obj and product__c is child object..

Visualforce Page

<apex:page standardController="Call2__c" sidebar="false" extensions="Add">
{!greet}
<apex:outputField value="{!Call2__c['Name']}" />
<apex:form >
<apex:pageblock id="pb" >
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Addrow}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}" />
    </apex:pageBlockButtons>
     <apex:pageMessages />
     
      <apex:pageblock id="pb1" >
         <apex:repeat value="{!lstInner}" var="e1" id="therepeat">
                <apex:panelGrid columns="6">
               
                <apex:panelGrid headerClass="Name">
                    <apex:facet name="header">Del</apex:facet>
                    <apex:commandButton value="X" action="{!Del}" rerender="pb1">
                        <apex:param name="rowToBeDeleted" value="{!e1.recCount}" assignTo="{!selectedRowIndex}"></apex:param>
                    </apex:commandButton>
                </apex:panelGrid>  
               
            <!--    <apex:panelGrid title="header" >
                    <apex:facet name="header">Call</apex:facet>
                    <apex:inputfield value="{!e1.pro.Call__c}"/>
                </apex:panelGrid>  -->
                
                       <apex:panelGrid title="header" >
                       <apex:facet name="header">Call</apex:facet>
                    <!--   <apex:outputLink value="/{!e1.pro.Id}">{!e1.pro.Call__c}</apex:outputLink>
                           <apex:inputfield value="{!e1.pro.Call__c}"/>
                        <apex:outputField value="{!e1.pro.Call__c}"/>-->
                        <apex:outputField value="{!Call2__c['Name']}" />
                    </apex:panelGrid>
               
                <apex:panelGrid title="header" >
                    <apex:facet name="header">Quantity</apex:facet>
                    <apex:inputfield value="{!e1.pro.Quantity__c}" />
                </apex:panelGrid>
               
                <apex:panelGrid >
                    <apex:facet name="header">Product</apex:facet>
                    <apex:inputfield value="{!e1.pro.Products__c}" />
                </apex:panelGrid>
               
                <apex:panelGrid >
                    <apex:facet name="header">Item</apex:facet>
                    <apex:inputfield value="{!e1.pro.Item__c}" />
                </apex:panelGrid>
               
                <apex:panelGrid >
                    <apex:facet name="header">Notes</apex:facet>
                    <apex:inputfield value="{!e1.pro.Notes__c}"/>
                </apex:panelGrid>
              
            </apex:panelgrid>
        </apex:repeat>
    </apex:pageBlock>    
</apex:pageblock>
</apex:form>

</apex:page>

Apex

public class Add
{  
    Public List<product__c> lstpro{get;set;}
    Public List<product__c> edpro{get;set;}
    Public call2__c cl;
    public String var {get;set;}
    public List<innerClass> lstInner {get;set;}
    public String selectedRowIndex {get;set;} 
    private List<product__c> calln;
    public id calid;
    public Integer count = 1;

   
    public PageReference Save()
    {
        var= ApexPages.currentPage().getParameters().get('Id');   
        PageReference pr = new PageReference('/apex/productrelated?'+var);
       
       // PageReference pr = new PageReference('/'+cl.id);
          
       // PageReference pr;
       // pr = Page.productrelated;
       
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error:Fields Can not Null');
        ApexPages.addMessage(myMsg);
      
        for(Integer j = 0;j<lstInner.size();j++)
        {
            lstpro.add(lstInner[j].pro);
        }
        insert lstpro;
        pr.setRedirect(True);
        return pr;
    }
   
    public void Addrow()
    {  
        count = count+1;
        addMore();     
    }

    public void addMore()
    {
        innerClass objInnerClass = new innerClass(count);
        lstInner.add(objInnerClass);   
              
    }
  
    public void Del()
    {
        lstInner.remove(Integer.valueOf(selectedRowIndex)-1);
        count = count - 1;
    }
   
    public Add(ApexPages.StandardController controller)
    {
        controller.addFields(new List<String>{'Name'});
        this.cl = (call2__c)controller.getRecord();
        lstpro = [select call__c,call__r.name,id,quantity__c,products__c,Item__c from Product__c where id=:cl.id];
        lstInner = new List<innerClass>();
        addMore();
        selectedRowIndex = '0';
       
    }
    public String getGreet() {
       return ' (' + cl.id + ')';
   }
 
    public class innerClass
    {      
      public String recCount{get;set;}
      public product__c pro {get;set;}
      
       public innerClass(Integer intCount)
        {
            recCount = String.valueOf(intCount);       
            pro = new product__c();
        }
    }
}
Or do you persist values in a workflow by creating properties in associated objects (like a Task or Case) that you use during flow execution?

I've inherited the task of Salesforce Development in our instance and was presented with a question.  I don't see a particular variable being persisted anywhere in related Updates located in the flow.  I was wondering if Flow instances come and go, if they persist anywhere, and the best practice for getting that data out.  My predecessor seemed to favor saving variables of importance to things like Task objects.  But if that hasn't been done in the past and I have a variable of importance, would that be available anywhere.  

Wow.  That was a long question(s).  

Hello,

 

I've come across the following scenario.

- I use a SOQL statement to get a list of records.

- I need to use the ID's from this list for a second subsequent query.  

 

Is there a way of getting all the ID's returned from the first query without looping through/travershing the result list first to get the ID's?

I don't wish to write a second query just to obtain the ID's but wondered could they alone be extracted from the first list without looping through the results?

 

Thanks for your help

Hi,  I have a requirement to do the following.

- In an object I have fields representating the days of the month (therefore up to 31 days).

- In a for loop I have values assigned for some days (possibly not all days of the month)

      The values have field value pairs of (daynumber, myvalue) 

 

       I need to assign the corrrect "myvalue" value to the correct field in my object which relates to the day value.

     .E.g. (10,'12.50')   should be assigned to field "Day_10_Price__c"

 

I know I can do this using a very large if statement (checking for the day and assigning it accordingly)  however this seems a bit too much or silly coding.  Does anyone know of a different way this can be achieved?  I know "Case" and "Switch" do not exist in Apex.

 

Any help or suggestions on this would be appreciated,  otherwise I assume I have to create the huge if statement.

 

Thanks in advance for your help!