• rwalrath144
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 25
    Replies

I have researched the code to set up the approval process trigger but I keep getting the following error:

 

Severity and Description Path Resource Location Creation Time Id
Save error: Variable does not exist: req1 Update Case Triggers/src/triggers Approval_Process.trigger line 12 1256322606703 445

This is my code:

 

trigger Approval_Process on Case (after insert, after update) { for(Case cs: Trigger.new) { cs = [ select ID from Case where id in :Trigger.new ]; if(cs.Agree_to_Submit_for_Approval__c == 'true') Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(cs.id); Approval.ProcessResult result = Approval.process(req1); System.assert(result.isSuccess()); System.assertEquals('Pending', result.getInstanceStatus(), 'Instance Status'+result.getInstanceStatus()); } }

The line the code is referring too is:

Approval.ProcessResult result = Approval.process(req1);

 

Please help

Hello

 

I am having a really hard time solving this problem. I have tried Controller extensions and triggers but can't seem to make this work. Let me start from the beginning.

 

I created a Visualforce page with a Standard Controller using a customer object call Call Log. I have another object called ASI Solutions. I have been able to use a field called Solutions Type to dynamically populate with the Solution Type from the ASI Solutions object on the Visualforce page for the Call Log. This field populates based on a field on Call Log called Additional Details. Now I am trying to pull over a text field called Solution Details.

 

I have tried to pull over as a table, as a detail page within the edit page (I actually created another post with this code but never got a response), and now as a trigger. This trigger is supposed to assign the Solution to the Call Log.

 

I will post this code because I do need assitance with adding testing code. But overall if somebody could point me in the right direction or offer any words of advice I would really appreciate it.

 

trigger SolutionDetails on Call_Log__c (before insert, before update) { List<ASI_Solutions__c> addSolutions = new List<ASI_Solutions__c>(); for(Call_Log__c CL: trigger.new){ List <ASI_Solutions__c> selectedSolutions = [select Solution_Details__c from ASI_Solutions__c where Incident_Reference__c= : CL.Solution_Type__c];{ Solution_Details__c SD = CL.Solution_Type__c; For (Call_Log__c cl : selectedSolutions){ addSolutions.addAll(pList); } try{ insert addSolutions; } Catch (DmlException de){ for (Integer i = 0; I<de.getNumDml(); i++){ CL.addError(de.getDmlMessage(i)); } } updateSolutions.doUpdate(selectedSolutions); } } }

 

I have a custom object called Call_Log that is the parent to another custom object called ASI Solutions. I have a field called "Additinal Details" from Call Log that dynamically populates another picklist called "Solution Type" on the same Visualforce page. The Visualforce page uses Call Log as the standard controller. I accomplish this with an Extended Controller called callsolutionExtension.

 

The fields populate nicely. What I am trying to do is display the detail page of the ASI Solution that is displayed in the Solution Type. All this I am trying to do dynamically using onchange and partial page refresh. I will paste the extension controller and the Visualforce code that is pertinate. The code is accepted however the detail of the Solution is not showing.

 

Controller Extension:

public class callsolutionExtension{ private final Call_Log__c call; public string solutionTypes {get; set;} public callsolutionExtension(ApexPages.StandardController callController){ this.call = (Call_Log__c)callController.getRecord(); solutionTypes = call.Solution_Type__c; } public List<selectOption> solutionTypeOptions {get { List<selectOption> solutionTypes = new List<selectOption>(); for (ASI_Solutions__c asr: [select Id, name from ASI_Solutions__c sol where sol.Incident_Reference__c = :call.Call_Details__c order by name]) solutionTypes.add(new selectOption (asr.id, asr.name)); return solutionTypes; } private set;} }

Below is the section that calls to extension and also the code at the bottom to populate the detail.

 

<apex:pageblockSection id="dependentSolutionType"> <apex:pageBlockSectionItem > <apex:outputLabel value="Solution Type" for="sol"/> <apex:panelGrid columns="2"> <apex:outputText value="{!Call_Log__c.Solution_Type__c}" rendered="false"/> <apex:selectList id="sol" value="{!solutionTypes}" size="1"> <apex:selectOptions value="{!solutionTypeOptions}"/> <apex:actionSupport event="onchange" reRender="thePage:solutiondetail"/> <apex:param name="detail" value="{!Call_Log__c.ID}"> </apex:param> </apex:selectList> </apex:panelGrid> </apex:pageBlockSectionItem> <apex:outputPanel id="solutiondetail"> <apex:detail subject="{!$CurrentPage.parameters.detail}" title="false" id="detail"> </apex:detail> </apex:outputPanel> </apex:page>

I could really use some help on this. I don't know what I am doing wrong. I think it might be the extended class isn't calling the ID of the Solution as well as the name and associating properly. I just don't know.

 

Thanks

I created a customer object called New Call Log. The call log is related to Solutions object where solutions is the parent. I am trying to create a VF page with Call log is the controller. A rep would enter in the information regarding the call and on the same page the Solution is shown below the call. I have been trying to work with sample code from the Recruiting application but it isn't working. This is what I have so far.

 

<apex:page standardController="New_Call_Log__c" id="thePage" showHeader="false"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!quickSave}" reRender="out, in" status="status"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection columns="1"> <apex:inputField value="{!New_Call_Log__c.Who_is_Calling__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Reason_for_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Additional_Details__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Date_of_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Name_of_Caller__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Callers_Email__c}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Solutions"> <apex:pageBlockTable value="{!New_Call_Log__c.solution__r}" var="JA" title="Solutions"> <apex:column value="{!JA.Solution__r.SolutionNote"></apex:column> <apex:column Value="{!JA.Soluiton__r.Incident_Reason__c"></apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

Any help would be very appreciated.

I just finished my first controller class. I am creating a Customer Webform for customer's to fill in when they have issues with their orders. My first goal is to capture all these inquiries in a customer object called Email Log. I have already set up the object with all the necessary fields. To control the type of data the customer's fill in I have a few picklist fields with set values. For the purposes of this controller I am starting with a field called further_details__c. I was hoping somebody with more experience could look at my code and let me know if anything needs to be changed. I was also hoping to get some help with building a test method so I can deploy it.

 

public class WebformIssuesOptions {String[] further_details = new String[]{};

 

public PageReference test() {

return null;

}

 

public List<SelectOption> getItems(){

List<SelectOption> options = new List<SelectOption>();options.add(

new SelectOption('Gift Card being shipped to another Country','Gift Card being shipped to another Country'));

options.add(new SelectOption('Image/Quality Issue','Image/Quality Issue'));options.add(

new SelectOption('Issue Retrieving E-Certificate','Issue Retrieving E-Certificate'));

options.add(new SelectOption('Need to Address/Ship Date','Need to Address/Ship Date'));options.add(

new SelectOption('Order Inquiry','Order Inquiry'));

options.add(new SelectOption('Order Not Received','Order Not Received'));options.add(

new SelectOption('Order Placed from another Country','Order Placed from another Country'));

options.add(new SelectOption('Website Issues','Website Issues'));

return options;

}

 

public String[] getfurther_details(){ return further_details;

 

}

 

public void setfurther_details (String[] further_details){ this.further_details = further_details;

}

 

}

 

 

I am following a template on the Wikki that provides instructions on how to create a customer web-to-case form. I copied and pasted the class code for the custom controller and I am only getting 70% test coverage.

 

public class SubmitCaseController {

 

public Case c { get; set; }

 

public String acctNum { get; set; }

 

public SubmitCaseController() {c = new Case();

}

 

public PageReference submitCase() {

List<Account> accts = [SELECT Id FROM Account WHERE AccountNumber = :acctNum];

if (accts.size() != 1) {ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Invalid account number');

ApexPages.addMessage(msg);

return null;}

else { try {

c.AccountId = accts.get(0).Id;

 

// now look for an associated contact with the same email

 Contact cnt = [SELECT Id FROM Contact WHERE AccountId = :c.AccountId AND Email = :c.SuppliedEmail LIMIT 1]; if (cnt != null)

c.ContactId = cnt.Id;

 

// Specify DML options to ensure the assignment rules are executed

Database.DMLOptions dmlOpts = new Database.DMLOptions();

dmlOpts.assignmentRuleHeader.useDefaultRule = true;

c.setOptions(dmlOpts);

 

// Insert the case

INSERT c;

return new PageReference('/thanks');} catch (Exception e) {

ApexPages.addMessages(e);

return null;

}

}

}

}

 

 

 http://wiki.developerforce.com/index.php/Creating_Custom_Web-To-Case_Forms_Using_Visualforce_and_Sites

I have created a class and trigger to process inbound emails in Sandbox. I get 100% coverage on my class and 94% coverage on my trigger. When I take it into Eclipse to deploy I only get 74% with the same exact code.

 

Is there a way to deploy from Sandbox without using Eclipse?

I am having a really hard time with one piece of code. I have created a class to take incoming emails and create a case. A trigger will fire before insert that reads the email and updates fields in the case with the appropriate values. I keep getting an error on the following code.

 

integer  EmailAddressMatchIdx  =  c.Description.indexOf(  EMAILADDRESS_TXT  );
string  EmailAddress_Value  = c.Description.substring(  EmailAddressMatchIdx  + EMAILADDRESS_TXT.length()  );
c.Consumer_Contact_Email__c = EmailAddress_Value;

integer  IPAddressMatchIdx  =  c.Description.indexOf(  IPADDRESS_TXT  );
string  IPAddress_Value  = c.Description.substring(  IPAddressMatchIdx  + IPADDRESS_TXT.length()  );
c.IP_Address__c = IPAddress_Value;
                
integer  Address1MatchIdx  =  c.Description.indexOf(  ADDRESS1_TXT  );
string  Address1_Value  = c.Description.substring(  Address1MatchIdx  + ADDRESS1_TXT.length()  );
c.Address_1__c = Address1_Value;

integer  Address2MatchIdx  =  c.Description.indexOf(  ADDRESS2_TXT  );
string  Address2_Value  = c.Description.substring(  Address2MatchIdx  + ADDRESS2_TXT.length()  );
c.Address_2__c = Address2_Value;

This is the error that I am getting:
 >>> cs_tools@d-2ip80vhgddefok4cnbidggn93.in.sandbox.salesforce.com >>> (Undelivered): 554 System.DmlException: Insert failed. First >>> exception on row 0; first error: >>> CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CheckFieldValues: data changed >>> by trigger for field Consumer Contact Email: invalid email address: >>> sarah.mccarthy@ymail.com | Address 1: (Senders address) | Address >>> 2: (Recipient Address) | End:End | this is the actual test of the

>>> script Class.cases.handleInboundEmail: line 41, column

I am having a really hard time with one piece of code. I have created a class to take incoming emails and create a case. A trigger will fire before insert that reads the email and updates fields in the case with the appropriate values. I have every field working but a field for Order Amount. For some reason it will not accept the code because it is a decimal field. I even changed the field properties to number without decimals and I still get he same error.

 

Here is the code:

 

private String  ORDERAMOUNT_TXT  =  'Order Amount:';

 

integer  OrderAmountMatchIdx  =  c.Description.indexOf(  ORDERAMOUNT_TXT  );
string  OrderAmount_Value  = c.Description.substring(  OrderAmountMatchIdx  + ORDERAMOUNT_TXT.length()  );
c.Order_Amount__c = OrderAmount_Value;

 

Error: Compile Error: Illegal assignment from String to Decimal at line 32 column 1 

 

Please help because I am out of ideas.

Message Edited by rwalrath144 on 07-17-2009 01:55 PM

I am hoping somebody can point me in the right direction. I work in customer service for a gift card company. We have a website we use to look up orders. When there is an issue we open a case in Salesforce for the issue. The case is opened using information on the order copied and pasted from the order website.

 

I want to be able to open a case through the order website where all the information is automatically populated to the case. I have researched all the integration methods possible but I am just not sure which path will be the best path. Our developer doesn't think it is possible but I know it is.

 

Please help point me in the right direction!

Hello

 

I am having a really hard time solving this problem. I have tried Controller extensions and triggers but can't seem to make this work. Let me start from the beginning.

 

I created a Visualforce page with a Standard Controller using a customer object call Call Log. I have another object called ASI Solutions. I have been able to use a field called Solutions Type to dynamically populate with the Solution Type from the ASI Solutions object on the Visualforce page for the Call Log. This field populates based on a field on Call Log called Additional Details. Now I am trying to pull over a text field called Solution Details.

 

I have tried to pull over as a table, as a detail page within the edit page (I actually created another post with this code but never got a response), and now as a trigger. This trigger is supposed to assign the Solution to the Call Log.

 

I will post this code because I do need assitance with adding testing code. But overall if somebody could point me in the right direction or offer any words of advice I would really appreciate it.

 

trigger SolutionDetails on Call_Log__c (before insert, before update) { List<ASI_Solutions__c> addSolutions = new List<ASI_Solutions__c>(); for(Call_Log__c CL: trigger.new){ List <ASI_Solutions__c> selectedSolutions = [select Solution_Details__c from ASI_Solutions__c where Incident_Reference__c= : CL.Solution_Type__c];{ Solution_Details__c SD = CL.Solution_Type__c; For (Call_Log__c cl : selectedSolutions){ addSolutions.addAll(pList); } try{ insert addSolutions; } Catch (DmlException de){ for (Integer i = 0; I<de.getNumDml(); i++){ CL.addError(de.getDmlMessage(i)); } } updateSolutions.doUpdate(selectedSolutions); } } }

 

I created a customer object called New Call Log. The call log is related to Solutions object where solutions is the parent. I am trying to create a VF page with Call log is the controller. A rep would enter in the information regarding the call and on the same page the Solution is shown below the call. I have been trying to work with sample code from the Recruiting application but it isn't working. This is what I have so far.

 

<apex:page standardController="New_Call_Log__c" id="thePage" showHeader="false"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!quickSave}" reRender="out, in" status="status"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection columns="1"> <apex:inputField value="{!New_Call_Log__c.Who_is_Calling__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Reason_for_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Additional_Details__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Date_of_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Name_of_Caller__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Callers_Email__c}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Solutions"> <apex:pageBlockTable value="{!New_Call_Log__c.solution__r}" var="JA" title="Solutions"> <apex:column value="{!JA.Solution__r.SolutionNote"></apex:column> <apex:column Value="{!JA.Soluiton__r.Incident_Reason__c"></apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

Any help would be very appreciated.

I just finished my first controller class. I am creating a Customer Webform for customer's to fill in when they have issues with their orders. My first goal is to capture all these inquiries in a customer object called Email Log. I have already set up the object with all the necessary fields. To control the type of data the customer's fill in I have a few picklist fields with set values. For the purposes of this controller I am starting with a field called further_details__c. I was hoping somebody with more experience could look at my code and let me know if anything needs to be changed. I was also hoping to get some help with building a test method so I can deploy it.

 

public class WebformIssuesOptions {String[] further_details = new String[]{};

 

public PageReference test() {

return null;

}

 

public List<SelectOption> getItems(){

List<SelectOption> options = new List<SelectOption>();options.add(

new SelectOption('Gift Card being shipped to another Country','Gift Card being shipped to another Country'));

options.add(new SelectOption('Image/Quality Issue','Image/Quality Issue'));options.add(

new SelectOption('Issue Retrieving E-Certificate','Issue Retrieving E-Certificate'));

options.add(new SelectOption('Need to Address/Ship Date','Need to Address/Ship Date'));options.add(

new SelectOption('Order Inquiry','Order Inquiry'));

options.add(new SelectOption('Order Not Received','Order Not Received'));options.add(

new SelectOption('Order Placed from another Country','Order Placed from another Country'));

options.add(new SelectOption('Website Issues','Website Issues'));

return options;

}

 

public String[] getfurther_details(){ return further_details;

 

}

 

public void setfurther_details (String[] further_details){ this.further_details = further_details;

}

 

}

 

 

I am following a template on the Wikki that provides instructions on how to create a customer web-to-case form. I copied and pasted the class code for the custom controller and I am only getting 70% test coverage.

 

public class SubmitCaseController {

 

public Case c { get; set; }

 

public String acctNum { get; set; }

 

public SubmitCaseController() {c = new Case();

}

 

public PageReference submitCase() {

List<Account> accts = [SELECT Id FROM Account WHERE AccountNumber = :acctNum];

if (accts.size() != 1) {ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Invalid account number');

ApexPages.addMessage(msg);

return null;}

else { try {

c.AccountId = accts.get(0).Id;

 

// now look for an associated contact with the same email

 Contact cnt = [SELECT Id FROM Contact WHERE AccountId = :c.AccountId AND Email = :c.SuppliedEmail LIMIT 1]; if (cnt != null)

c.ContactId = cnt.Id;

 

// Specify DML options to ensure the assignment rules are executed

Database.DMLOptions dmlOpts = new Database.DMLOptions();

dmlOpts.assignmentRuleHeader.useDefaultRule = true;

c.setOptions(dmlOpts);

 

// Insert the case

INSERT c;

return new PageReference('/thanks');} catch (Exception e) {

ApexPages.addMessages(e);

return null;

}

}

}

}

 

 

 http://wiki.developerforce.com/index.php/Creating_Custom_Web-To-Case_Forms_Using_Visualforce_and_Sites

I have created a class and trigger to process inbound emails in Sandbox. I get 100% coverage on my class and 94% coverage on my trigger. When I take it into Eclipse to deploy I only get 74% with the same exact code.

 

Is there a way to deploy from Sandbox without using Eclipse?

I am having a really hard time with one piece of code. I have created a class to take incoming emails and create a case. A trigger will fire before insert that reads the email and updates fields in the case with the appropriate values. I keep getting an error on the following code.

 

integer  EmailAddressMatchIdx  =  c.Description.indexOf(  EMAILADDRESS_TXT  );
string  EmailAddress_Value  = c.Description.substring(  EmailAddressMatchIdx  + EMAILADDRESS_TXT.length()  );
c.Consumer_Contact_Email__c = EmailAddress_Value;

integer  IPAddressMatchIdx  =  c.Description.indexOf(  IPADDRESS_TXT  );
string  IPAddress_Value  = c.Description.substring(  IPAddressMatchIdx  + IPADDRESS_TXT.length()  );
c.IP_Address__c = IPAddress_Value;
                
integer  Address1MatchIdx  =  c.Description.indexOf(  ADDRESS1_TXT  );
string  Address1_Value  = c.Description.substring(  Address1MatchIdx  + ADDRESS1_TXT.length()  );
c.Address_1__c = Address1_Value;

integer  Address2MatchIdx  =  c.Description.indexOf(  ADDRESS2_TXT  );
string  Address2_Value  = c.Description.substring(  Address2MatchIdx  + ADDRESS2_TXT.length()  );
c.Address_2__c = Address2_Value;

This is the error that I am getting:
 >>> cs_tools@d-2ip80vhgddefok4cnbidggn93.in.sandbox.salesforce.com >>> (Undelivered): 554 System.DmlException: Insert failed. First >>> exception on row 0; first error: >>> CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CheckFieldValues: data changed >>> by trigger for field Consumer Contact Email: invalid email address: >>> sarah.mccarthy@ymail.com | Address 1: (Senders address) | Address >>> 2: (Recipient Address) | End:End | this is the actual test of the

>>> script Class.cases.handleInboundEmail: line 41, column