-
ChatterFeed
-
10Best Answers
-
0Likes Received
-
0Likes Given
-
0Questions
-
60Replies
sendgrid-apex unmanaged package preventing deploy to production
Preface - I'm the using sendgrid-apex unmanaged package here - https://github.com/sendgrid/sendgrid-apex
I've written a very simple class in sandbox that allows me to send emails via SendGrid. I deployed to staging successfully, but upon attempting to deploy in production, I received 4 error messages. There are a couple things odd about this:
1) This has been untouched for 3 years and to think that these errors have been here all along is ludicrous to me (though maybe winter 17 broke something)
2) In the second attempt at a changeset, I didn't include the class dependencies that were creating the errors, however the errors still prevented a successful deploy even though the classes are existing in production and are not part of the changeset
Below are the errors i'm seeing...
SendGridTest
testAddHeader
System.AssertException: Assertion Failed: Expected: &headers=%7B%22key%22%3A%22value%22%2C%22other%22%3A%22other-value%22%7D, Actual: &headers=%7B%22other%22%3A%22other-value%22%2C%22key%22%3A%22value%22%7D
Stack Trace: Class.SendGridTest.testAddHeader: line 190, column 1
SendGridTest
testAddSection
System.AssertException: Assertion Failed: Expected: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key%22%3A%22set_section_value%22%2C%22set_section_key_2%22%3A%22set_section_value_2%22%7D%7D, Actual: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key_2%22%3A%22set_section_value_2%22%2C%22set_section_key%22%3A%22set_section_value%22%7D%7D
Stack Trace: Class.SendGridTest.testAddSection: line 171, column 1
SmtpapiTest
setSetFilters
System.AssertException: Assertion Failed: Expected: {"filters":{"footer":{"settings":{"enable":"1","text/plain":"You can haz footers!"}}}}, Actual: {"filters":{"footer":{"settings":{"text/plain":"You can haz footers!","enable":"1"}}}}
Stack Trace: Class.SmtpapiTest.setSetFilters: line 116, column 1
SmtpapiTest
testAddSection
System.AssertException: Assertion Failed: Expected: {"section":{"set_section_key":"set_section_value","set_section_key_2":"set_section_value_2"}}, Actual: {"section":{"set_section_key_2":"set_section_value_2","set_section_key":"set_section_value"}}
Stack Trace: Class.SmtpapiTest.testAddSection: line 80, column 1
I've written a very simple class in sandbox that allows me to send emails via SendGrid. I deployed to staging successfully, but upon attempting to deploy in production, I received 4 error messages. There are a couple things odd about this:
1) This has been untouched for 3 years and to think that these errors have been here all along is ludicrous to me (though maybe winter 17 broke something)
2) In the second attempt at a changeset, I didn't include the class dependencies that were creating the errors, however the errors still prevented a successful deploy even though the classes are existing in production and are not part of the changeset
Below are the errors i'm seeing...
SendGridTest
testAddHeader
System.AssertException: Assertion Failed: Expected: &headers=%7B%22key%22%3A%22value%22%2C%22other%22%3A%22other-value%22%7D, Actual: &headers=%7B%22other%22%3A%22other-value%22%2C%22key%22%3A%22value%22%7D
Stack Trace: Class.SendGridTest.testAddHeader: line 190, column 1
SendGridTest
testAddSection
System.AssertException: Assertion Failed: Expected: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key%22%3A%22set_section_value%22%2C%22set_section_key_2%22%3A%22set_section_value_2%22%7D%7D, Actual: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key_2%22%3A%22set_section_value_2%22%2C%22set_section_key%22%3A%22set_section_value%22%7D%7D
Stack Trace: Class.SendGridTest.testAddSection: line 171, column 1
SmtpapiTest
setSetFilters
System.AssertException: Assertion Failed: Expected: {"filters":{"footer":{"settings":{"enable":"1","text/plain":"You can haz footers!"}}}}, Actual: {"filters":{"footer":{"settings":{"text/plain":"You can haz footers!","enable":"1"}}}}
Stack Trace: Class.SmtpapiTest.setSetFilters: line 116, column 1
SmtpapiTest
testAddSection
System.AssertException: Assertion Failed: Expected: {"section":{"set_section_key":"set_section_value","set_section_key_2":"set_section_value_2"}}, Actual: {"section":{"set_section_key_2":"set_section_value_2","set_section_key":"set_section_value"}}
Stack Trace: Class.SmtpapiTest.testAddSection: line 80, column 1
- Spacesift
- December 30, 2016
- Like
- 0
- Continue reading or reply
I need to convert a custom text field value to display as a link
We have a custom text field called Master Tracking Number that represents the tracking number used by UPS, FedEx, etc. I would love to be able to display this value as a link so that our users can click on the link which takes them to the link details. So, while the value of this field should display as 123ABC456DEF (unique number for each sales order) I would like the link to point to: https://www.google.com/#q=123ABC456DEF
Is this possible?
Is this possible?
- Steven Vawdrey 13
- December 28, 2016
- Like
- 0
- Continue reading or reply
How to determine correct account to associate to user provisioned trough social login for communities
Hi,
I am looking for what are best practice or common strategies used when you have a B2B communites where users can login with social sign in?
To which account should communites user that are provisioned in the apex registration handler be associated with? E.g if they are signing in with Google or Facebook, how would you associate them with the correct Account.
What are the best practices and common practices here?
I am looking for what are best practice or common strategies used when you have a B2B communites where users can login with social sign in?
To which account should communites user that are provisioned in the apex registration handler be associated with? E.g if they are signing in with Google or Facebook, how would you associate them with the correct Account.
What are the best practices and common practices here?
- TheRotnelson
- December 28, 2016
- Like
- 0
- Continue reading or reply
Trigger Related Task
I have one custom object, there are two fields, one multiselect picklist and second Text Field.
In multiselect picklist, there are 5 values : Mango, Apple, Orange, Guava and Grapes.
The requirement is that if I select Mango in picklist, then It needs to show Yellow Color fruit in the second text field.
If I select Apple in picklist , then it must show Red Color fruit in the second text field..
If I select Mango and Orange, then it should show Yellow Color Fruit, red Color Fruit in the second text field.
I need to write a trigger for this. Please help how to acheive the same.
Do I need to store these values, "Yellow Color Fruit", "red Color Fruit" somewhere in the same object....
In multiselect picklist, there are 5 values : Mango, Apple, Orange, Guava and Grapes.
The requirement is that if I select Mango in picklist, then It needs to show Yellow Color fruit in the second text field.
If I select Apple in picklist , then it must show Red Color fruit in the second text field..
If I select Mango and Orange, then it should show Yellow Color Fruit, red Color Fruit in the second text field.
I need to write a trigger for this. Please help how to acheive the same.
Do I need to store these values, "Yellow Color Fruit", "red Color Fruit" somewhere in the same object....
- ashu 6112
- December 28, 2016
- Like
- 0
- Continue reading or reply
date in GMT to be converted to CET
Hello,
I have ran below code:
DateTime today = Datetime.now();
System.debug(today);
What I get is date and time in GMT and I need Centrl European Time (CET) - in other word GMT plus 1 hour.
Can anyone advise, please?
Many thanks,
Milan
I have ran below code:
DateTime today = Datetime.now();
System.debug(today);
What I get is date and time in GMT and I need Centrl European Time (CET) - in other word GMT plus 1 hour.
Can anyone advise, please?
Many thanks,
Milan
- Milan Hrdlicka
- December 28, 2016
- Like
- 0
- Continue reading or reply
What's wrong with this use of inputHidden?
I'm trying to fill a hidden custom field through a parameter provided via the URL in a Visualforce page on a Force.com site that creates leads. I'm getting the following error: "Error: Literal value is required for attribute id in apex:inputHidden in NomineeRegistration at line 38 column 99."
Here's my Apex:
And the highlights of the VF page:
Here's my Apex:
public class myWeb2LeadExtension { private final Lead weblead; public myWeb2LeadExtension(ApexPages.StandardController stdController) { weblead = (Lead)stdController.getRecord(); } public PageReference saveLead() { try { insert(weblead); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference p = Page.ThankYou; p.setRedirect(true); return p; }
And the highlights of the VF page:
<apex:page standardController="Lead" extensions="myWeb2LeadExtension" title="Register for Digital Accelerator" showHeader="false" standardStylesheets="true"> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > <apex:messages id="error" styleClass="errorMsg" layout="table" style="margin-top:1em;"/> <apex:pageBlock title="" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Submit" action="{!saveLead}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Register for Digital Accelerator" collapsible="false" columns="1"> <div class = "requiredInput"> <div class = "requiredBlock"></div> <apex:inputField value="{!Lead.FirstName}" required="true"/> <apex:inputField value="{!Lead.LastName}" required="true"/> <apex:inputField value="{!Lead.Nickname__c}" required="false"/> <apex:inputField value="{!Lead.Title}" required="true"/> <apex:inputField value="{!Lead.Email}" required="true"/> <apex:inputField value="{!Lead.Company}" required="true"/> <apex:inputField value="{!Lead.Phone}" required="true"/> <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/> </div> <apex:inputHidden id="{!Lead.Referred_By__c}" value="{!$CurrentPage.parameters.Referred"/> </apex:pageBlockSection> </apex:pageBlock>
- Will Edwards
- June 13, 2016
- Like
- 0
- Continue reading or reply
Question regarding Javascript Remoting example in the VF developers guide
Hi,
I am not able to figure why the JS remoting example shown at the following location would ever work correctly.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
Shouldn't the merge field syntax {!$RemoteAction.AccountRemoter.getAccount} _not_ be understood by Javascript?
For example,when I amend the examples as follows :
Change:
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.AccountRemoter.getAccount}',
accountName,
function, {...});
To:
AccountRemoter.getAccount(
accountName,
function, {...});
It works perfectly as expected.
What am I missing?
- schndt
- June 09, 2016
- Like
- 0
- Continue reading or reply
Commercial Real Estate App
Hi out there,
I am new on this amazing platform and I want to build a Commercial Real Estate App on top force.com. I know there are a couple in the AppExchange but they are too extensive for my needs.
I know all the functionality I want to include.
My question is if I can use the Lightning to do this or if I need to write code?
Best Regards,
- Jörgen Ekelund
I am new on this amazing platform and I want to build a Commercial Real Estate App on top force.com. I know there are a couple in the AppExchange but they are too extensive for my needs.
I know all the functionality I want to include.
My question is if I can use the Lightning to do this or if I need to write code?
Best Regards,
- Jörgen Ekelund
- Jörgen Ekelund 1
- June 09, 2016
- Like
- 0
- Continue reading or reply
How to set up a VF page including buttons and date fields to run scheduled Apex class like scheduling reports
Hi All,
I have an Apex controller to a VF page. It will run everytime I click a button in the VF page. The controller works well. It's function is to clear a whole sObject old records and create a batch of new records.
When it comes to the second part to write a scheduled apex job, it is really confusing. There are a lot of posts about Apex Scheduler to run every hour or everyday. But would it be possible to set up a VF page just like the following (screenshot from Reports)? Users are able to choose wheter to start scheduling the apex job or stop scheduling; they can choose the date to start and cease; they can choose what time they would like the scheduled Apex job to run.
I would like to know if it is doable. Any hints or sample codes are welcomed. If you have ever seen any post similar to it, please shart it to me!
Thanks!
I have an Apex controller to a VF page. It will run everytime I click a button in the VF page. The controller works well. It's function is to clear a whole sObject old records and create a batch of new records.
When it comes to the second part to write a scheduled apex job, it is really confusing. There are a lot of posts about Apex Scheduler to run every hour or everyday. But would it be possible to set up a VF page just like the following (screenshot from Reports)? Users are able to choose wheter to start scheduling the apex job or stop scheduling; they can choose the date to start and cease; they can choose what time they would like the scheduled Apex job to run.
I would like to know if it is doable. Any hints or sample codes are welcomed. If you have ever seen any post similar to it, please shart it to me!
Thanks!
- BCDBSA
- June 08, 2016
- Like
- 1
- Continue reading or reply
Account address and contact address update challenge.
I don't have the "Set object variables" in my Process builder options. I don't have the icons for picklists... please help thanks.
- Vida Yirenkyi
- September 16, 2015
- Like
- 0
- Continue reading or reply
sendgrid-apex unmanaged package preventing deploy to production
Preface - I'm the using sendgrid-apex unmanaged package here - https://github.com/sendgrid/sendgrid-apex
I've written a very simple class in sandbox that allows me to send emails via SendGrid. I deployed to staging successfully, but upon attempting to deploy in production, I received 4 error messages. There are a couple things odd about this:
1) This has been untouched for 3 years and to think that these errors have been here all along is ludicrous to me (though maybe winter 17 broke something)
2) In the second attempt at a changeset, I didn't include the class dependencies that were creating the errors, however the errors still prevented a successful deploy even though the classes are existing in production and are not part of the changeset
Below are the errors i'm seeing...
SendGridTest
testAddHeader
System.AssertException: Assertion Failed: Expected: &headers=%7B%22key%22%3A%22value%22%2C%22other%22%3A%22other-value%22%7D, Actual: &headers=%7B%22other%22%3A%22other-value%22%2C%22key%22%3A%22value%22%7D
Stack Trace: Class.SendGridTest.testAddHeader: line 190, column 1
SendGridTest
testAddSection
System.AssertException: Assertion Failed: Expected: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key%22%3A%22set_section_value%22%2C%22set_section_key_2%22%3A%22set_section_value_2%22%7D%7D, Actual: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key_2%22%3A%22set_section_value_2%22%2C%22set_section_key%22%3A%22set_section_value%22%7D%7D
Stack Trace: Class.SendGridTest.testAddSection: line 171, column 1
SmtpapiTest
setSetFilters
System.AssertException: Assertion Failed: Expected: {"filters":{"footer":{"settings":{"enable":"1","text/plain":"You can haz footers!"}}}}, Actual: {"filters":{"footer":{"settings":{"text/plain":"You can haz footers!","enable":"1"}}}}
Stack Trace: Class.SmtpapiTest.setSetFilters: line 116, column 1
SmtpapiTest
testAddSection
System.AssertException: Assertion Failed: Expected: {"section":{"set_section_key":"set_section_value","set_section_key_2":"set_section_value_2"}}, Actual: {"section":{"set_section_key_2":"set_section_value_2","set_section_key":"set_section_value"}}
Stack Trace: Class.SmtpapiTest.testAddSection: line 80, column 1
I've written a very simple class in sandbox that allows me to send emails via SendGrid. I deployed to staging successfully, but upon attempting to deploy in production, I received 4 error messages. There are a couple things odd about this:
1) This has been untouched for 3 years and to think that these errors have been here all along is ludicrous to me (though maybe winter 17 broke something)
2) In the second attempt at a changeset, I didn't include the class dependencies that were creating the errors, however the errors still prevented a successful deploy even though the classes are existing in production and are not part of the changeset
Below are the errors i'm seeing...
SendGridTest
testAddHeader
System.AssertException: Assertion Failed: Expected: &headers=%7B%22key%22%3A%22value%22%2C%22other%22%3A%22other-value%22%7D, Actual: &headers=%7B%22other%22%3A%22other-value%22%2C%22key%22%3A%22value%22%7D
Stack Trace: Class.SendGridTest.testAddHeader: line 190, column 1
SendGridTest
testAddSection
System.AssertException: Assertion Failed: Expected: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key%22%3A%22set_section_value%22%2C%22set_section_key_2%22%3A%22set_section_value_2%22%7D%7D, Actual: &x-smtpapi=%7B%22section%22%3A%7B%22set_section_key_2%22%3A%22set_section_value_2%22%2C%22set_section_key%22%3A%22set_section_value%22%7D%7D
Stack Trace: Class.SendGridTest.testAddSection: line 171, column 1
SmtpapiTest
setSetFilters
System.AssertException: Assertion Failed: Expected: {"filters":{"footer":{"settings":{"enable":"1","text/plain":"You can haz footers!"}}}}, Actual: {"filters":{"footer":{"settings":{"text/plain":"You can haz footers!","enable":"1"}}}}
Stack Trace: Class.SmtpapiTest.setSetFilters: line 116, column 1
SmtpapiTest
testAddSection
System.AssertException: Assertion Failed: Expected: {"section":{"set_section_key":"set_section_value","set_section_key_2":"set_section_value_2"}}, Actual: {"section":{"set_section_key_2":"set_section_value_2","set_section_key":"set_section_value"}}
Stack Trace: Class.SmtpapiTest.testAddSection: line 80, column 1
- Spacesift
- December 30, 2016
- Like
- 0
- Continue reading or reply
Custom button to Generate PDF,Save it in attachments and email it.
Hi i am having a custom button,which when clicked generates the PDF and saves it in attachment.
Now i am trying to make it as email too.
so when the custom button is clicked,generate pdf ,save the pdf to attachment and email it to particular user email.
How can i do it?Can i do it on single button?Or do i need two buttons. 1 .generate and save
2.email pdf?
I am confused and struck here .I am able to generate it and save as attachment.
But i want all three steps(generate,save and email) in single button.Please help.
Thanks in advance.
Now i am trying to make it as email too.
so when the custom button is clicked,generate pdf ,save the pdf to attachment and email it to particular user email.
How can i do it?Can i do it on single button?Or do i need two buttons. 1 .generate and save
2.email pdf?
I am confused and struck here .I am able to generate it and save as attachment.
But i want all three steps(generate,save and email) in single button.Please help.
Thanks in advance.
- Linda 98
- December 29, 2016
- Like
- 0
- Continue reading or reply
I need to convert a custom text field value to display as a link
We have a custom text field called Master Tracking Number that represents the tracking number used by UPS, FedEx, etc. I would love to be able to display this value as a link so that our users can click on the link which takes them to the link details. So, while the value of this field should display as 123ABC456DEF (unique number for each sales order) I would like the link to point to: https://www.google.com/#q=123ABC456DEF
Is this possible?
Is this possible?
- Steven Vawdrey 13
- December 28, 2016
- Like
- 0
- Continue reading or reply
How to determine correct account to associate to user provisioned trough social login for communities
Hi,
I am looking for what are best practice or common strategies used when you have a B2B communites where users can login with social sign in?
To which account should communites user that are provisioned in the apex registration handler be associated with? E.g if they are signing in with Google or Facebook, how would you associate them with the correct Account.
What are the best practices and common practices here?
I am looking for what are best practice or common strategies used when you have a B2B communites where users can login with social sign in?
To which account should communites user that are provisioned in the apex registration handler be associated with? E.g if they are signing in with Google or Facebook, how would you associate them with the correct Account.
What are the best practices and common practices here?
- TheRotnelson
- December 28, 2016
- Like
- 0
- Continue reading or reply
Expose APEXT REST Webservices to external system when records is updating(trigger)
Hello there,
I am having below requirement.
In salesforce when a record is updated then send data of that record to external system using reset API JSON file.
I have written below code but I am not sure whether I am going in right direction
Trigger
rigger ImplementationPlanActivity on Implementation_Plan_Activity__c (after update) {
Trigger_Settings__c triggerSettings = Trigger_Settings__c.getInstance();
if(triggerSettings.ImplementationPlanActivity__c == false){
return;
}
set<Id> IPAIdSet=new Set<Id>();
for(Implementation_Plan_Activity__c IPArecord : trigger.new ){
IPAIdSet.add(IPArecord .id);
}
IPAResetAPIClass.IPAData(IPAIdSet);
}
}
Webservice class
global class IPAResetAPIClass{
@future(callout=true)
global static void IPAData(Set<Id> newIPASetId){
List<Implementation_Plan_Activity__c> ipaNewList=[SELECT id,Name,
Account_Manager__r.Name,
Account_Manager__r.Email,
Account_Specialist__r.Name,
Account_Specialist__r.Email,
SFID18__c ,
RecordTypeId
FROM Implementation_Plan_Activity__c where Id IN : newIPASetId];
List<impWarpperClass> warpperIPAList=new List<impWarpperClass>();
warpperIPAList.add(new impWarpperClass(ipaNewList[0].id,
ipaNewList[0].Name,
ipaNewList[0].Account_Manager__r.Name,
ipaNewList[0].Account_Manager__r.Email,
ipaNewList[0].Account_Specialist__r.Name,
ipaNewList[0].Account_Specialist__r.Email,
ipaNewList[0].SFID18__c,
ipaNewList[0].RecordTypeId));
RecordType recordTypeRecord=[Select id,Name from RecordType where id=:ipaNewList[0].RecordTypeId limit 1];
string resource=null;
if(recordTypeRecord.Name=='Auto Provisioning'){
resource='Auto Provisioning';
}
else if(recordTypeRecord.Name =='Workbook'){
resource='Workbook';
}
system.debug('*********warpperIPAList='+warpperIPAList);
string JSONString=JSON.serializePretty(warpperIPAList);
system.debug('*********serialized imp='+JSONString);
string endURL;
endURL=geURL+resource+'/'+ipaNewList[0].id;
system.debug('*********endURL='+endURL);
HttpRequest req=new HttpRequest();
//Set HttpRequest Method
req.setMethod('POST');
req.setHeader('content-type', 'application/json');
//Set HTTPRequest Endpoint dummy url
req.setEndpoint('http://requestb.in/13auzf41');
//req.setEndpoint(endURL);
//Set HTTP Request Body
req.setBody(JSONString);
Http http = new Http();
try{
HTTPResponse res = http.send(req);
//Helpful debug messages
System.debug(res.toString());
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
System.debug('Content: ' + res.getBody());
//we can create success object record
}
catch(Exception e){
System.debug('******* error message='+e);
//we can create error object record
}
}
global class impWarpperClass{
global string IPAId{get;set;}
global string IPAName{get;set;}
global string IPAAccManagerName{get;set;}
global string IPAAccManagerEmail{get;set;}
global string IPAAccSpecialListrName{get;set;}
global string IPAAccSpecialListEmail{get;set;}
global string IPASFDCId{get;set;}
global string IPARecordTypeId{get;set;}
global impWarpperClass(string IPAId,string IPAName,
string IPAAccManagerName,
String IPAAccManagerEmail,
string IPAAccSpecialListrName,
string IPAAccSpecialListEmail,
string IPASFDCId,
string IPARecordTypeId){
this.IPAId=IPAId;
this.IPAName=IPAName;
this.IPAAccManagerName=IPAAccManagerName;
this.IPAAccManagerEmail=IPAAccManagerEmail;
this.IPAAccSpecialListrName=IPAAccSpecialListrName;
this.IPAAccManagerEmail=IPAAccSpecialListEmail;
this.IPASFDCId=IPASFDCId;
this.IPARecordTypeId=IPARecordTypeId;
}
}
}
}
am I going right dirction. is this correct way to send data from salesforce to external system using rest api JSON file.
If I am wrong can any please let me know how can I expose salesforce data to external system when records is updted in salesforce.
Thank you.
I am having below requirement.
In salesforce when a record is updated then send data of that record to external system using reset API JSON file.
I have written below code but I am not sure whether I am going in right direction
Trigger
rigger ImplementationPlanActivity on Implementation_Plan_Activity__c (after update) {
Trigger_Settings__c triggerSettings = Trigger_Settings__c.getInstance();
if(triggerSettings.ImplementationPlanActivity__c == false){
return;
}
set<Id> IPAIdSet=new Set<Id>();
for(Implementation_Plan_Activity__c IPArecord : trigger.new ){
IPAIdSet.add(IPArecord .id);
}
IPAResetAPIClass.IPAData(IPAIdSet);
}
}
Webservice class
global class IPAResetAPIClass{
@future(callout=true)
global static void IPAData(Set<Id> newIPASetId){
List<Implementation_Plan_Activity__c> ipaNewList=[SELECT id,Name,
Account_Manager__r.Name,
Account_Manager__r.Email,
Account_Specialist__r.Name,
Account_Specialist__r.Email,
SFID18__c ,
RecordTypeId
FROM Implementation_Plan_Activity__c where Id IN : newIPASetId];
List<impWarpperClass> warpperIPAList=new List<impWarpperClass>();
warpperIPAList.add(new impWarpperClass(ipaNewList[0].id,
ipaNewList[0].Name,
ipaNewList[0].Account_Manager__r.Name,
ipaNewList[0].Account_Manager__r.Email,
ipaNewList[0].Account_Specialist__r.Name,
ipaNewList[0].Account_Specialist__r.Email,
ipaNewList[0].SFID18__c,
ipaNewList[0].RecordTypeId));
RecordType recordTypeRecord=[Select id,Name from RecordType where id=:ipaNewList[0].RecordTypeId limit 1];
string resource=null;
if(recordTypeRecord.Name=='Auto Provisioning'){
resource='Auto Provisioning';
}
else if(recordTypeRecord.Name =='Workbook'){
resource='Workbook';
}
system.debug('*********warpperIPAList='+warpperIPAList);
string JSONString=JSON.serializePretty(warpperIPAList);
system.debug('*********serialized imp='+JSONString);
string endURL;
endURL=geURL+resource+'/'+ipaNewList[0].id;
system.debug('*********endURL='+endURL);
HttpRequest req=new HttpRequest();
//Set HttpRequest Method
req.setMethod('POST');
req.setHeader('content-type', 'application/json');
//Set HTTPRequest Endpoint dummy url
req.setEndpoint('http://requestb.in/13auzf41');
//req.setEndpoint(endURL);
//Set HTTP Request Body
req.setBody(JSONString);
Http http = new Http();
try{
HTTPResponse res = http.send(req);
//Helpful debug messages
System.debug(res.toString());
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
System.debug('Content: ' + res.getBody());
//we can create success object record
}
catch(Exception e){
System.debug('******* error message='+e);
//we can create error object record
}
}
global class impWarpperClass{
global string IPAId{get;set;}
global string IPAName{get;set;}
global string IPAAccManagerName{get;set;}
global string IPAAccManagerEmail{get;set;}
global string IPAAccSpecialListrName{get;set;}
global string IPAAccSpecialListEmail{get;set;}
global string IPASFDCId{get;set;}
global string IPARecordTypeId{get;set;}
global impWarpperClass(string IPAId,string IPAName,
string IPAAccManagerName,
String IPAAccManagerEmail,
string IPAAccSpecialListrName,
string IPAAccSpecialListEmail,
string IPASFDCId,
string IPARecordTypeId){
this.IPAId=IPAId;
this.IPAName=IPAName;
this.IPAAccManagerName=IPAAccManagerName;
this.IPAAccManagerEmail=IPAAccManagerEmail;
this.IPAAccSpecialListrName=IPAAccSpecialListrName;
this.IPAAccManagerEmail=IPAAccSpecialListEmail;
this.IPASFDCId=IPASFDCId;
this.IPARecordTypeId=IPARecordTypeId;
}
}
}
}
am I going right dirction. is this correct way to send data from salesforce to external system using rest api JSON file.
If I am wrong can any please let me know how can I expose salesforce data to external system when records is updted in salesforce.
Thank you.
- Aruna
- December 28, 2016
- Like
- 0
- Continue reading or reply
browser recognition
Hi, I'm looking to see if there is any apex code using a user agent string from a browser that will identify what browser the user is using to log into Salesforce with. I need to have a pop up message that will direct the user to use Google Chrome. Is that possible?
Regards
Roseanne
Regards
Roseanne
- Roseanne Miller 16
- December 28, 2016
- Like
- 0
- Continue reading or reply
Trigger.New pulling Old Values in After Update Opportunity
I'm working with Triggers and I believe there is an unreported bug that I have found regarding Trigger.New and Trigger.Old. Here is the bug:
1. It's a Trigger on Opportunity after update. I even tested this with before update.
2. We are using Salesforce API (wsdl) to update the Opportunity from an external application.
3. When the Trigger fires, the objects Trigger.New and Trigger.Old (any field), holds the same exact values.
I expected that Trigger.New would hold the new values (the ones that will be updated in the database after the order of execution completes), while the Trigger.Old would hold the current/previous values. I made sure there are no workflows and other processes interfering with this particular field. I know I know, there are tons of resources showing how to compare the old and new values and I've tested them all to no avail.
The important thing to note: When a user updates the Opportunity in Salesforce, the Trigger works perfectly fine. The Trigger.New reflects the new values that will be updated, and the Trigger.Old reflects the old values. BUT when we are updating the Opportunity from an external application using the Salesforce API wsdl, the Trigger.Old and Trigger.New objects are exactly identical when the trigger fires. However, after the entire Order of Execution complets, the fields do indeed reflect the new values in the Salesforce interface.
Has anyone had this issue? Or can somebody test/help with any ideas/input?
Thanks a lot.
1. It's a Trigger on Opportunity after update. I even tested this with before update.
2. We are using Salesforce API (wsdl) to update the Opportunity from an external application.
3. When the Trigger fires, the objects Trigger.New and Trigger.Old (any field), holds the same exact values.
I expected that Trigger.New would hold the new values (the ones that will be updated in the database after the order of execution completes), while the Trigger.Old would hold the current/previous values. I made sure there are no workflows and other processes interfering with this particular field. I know I know, there are tons of resources showing how to compare the old and new values and I've tested them all to no avail.
The important thing to note: When a user updates the Opportunity in Salesforce, the Trigger works perfectly fine. The Trigger.New reflects the new values that will be updated, and the Trigger.Old reflects the old values. BUT when we are updating the Opportunity from an external application using the Salesforce API wsdl, the Trigger.Old and Trigger.New objects are exactly identical when the trigger fires. However, after the entire Order of Execution complets, the fields do indeed reflect the new values in the Salesforce interface.
Has anyone had this issue? Or can somebody test/help with any ideas/input?
Thanks a lot.
- Starforce1
- December 28, 2016
- Like
- 0
- Continue reading or reply
Error: Compile Error: Invalid field
I am creating a test class for an Apex class. My code:
@isTest
public class LsUnitListTest
{
static testMethod void testLsUnitListPage()
{
Lease__c objLease = new Lease__c(Name = 'Test Lease');
insert objLease;
List<Lease_Unit_Association__c> lstUnit = new List<Lease_Unit_Association__c>{ new Unit__c( Unit__c = 'Test Unit1', Unit__c = objLease.ID, Property_Unit__r.Unit_Status_Code__c = 'N'),
I am encountering the following error:
Error: Compile Error: Invalid field Unit__c for SObject Unit__c at line 10 column 115
I am not quite sure what it is telling me. Do I have an invalid field type in the test? I get the feeling it is something obvious. Any help would be appreciated. Thanks.
@isTest
public class LsUnitListTest
{
static testMethod void testLsUnitListPage()
{
Lease__c objLease = new Lease__c(Name = 'Test Lease');
insert objLease;
List<Lease_Unit_Association__c> lstUnit = new List<Lease_Unit_Association__c>{ new Unit__c( Unit__c = 'Test Unit1', Unit__c = objLease.ID, Property_Unit__r.Unit_Status_Code__c = 'N'),
I am encountering the following error:
Error: Compile Error: Invalid field Unit__c for SObject Unit__c at line 10 column 115
I am not quite sure what it is telling me. Do I have an invalid field type in the test? I get the feeling it is something obvious. Any help would be appreciated. Thanks.
- Robert Robinson
- December 28, 2016
- Like
- 0
- Continue reading or reply
SOAP Request in APEX - Error Bad Request 400
I am sending a SOAP Request from Salesforce and I am getting a bad request 400 response.
I have a succesfull POST request through POSTMAN so I decided to take the raw XML and insert it into string variables. Here is what I am sending.
I have a succesfull POST request through POSTMAN so I decided to take the raw XML and insert it into string variables. Here is what I am sending.
public class ClientInsertCallout { @future (callout=true) public static void sendNotification(String name, ID Id) { // Test Variables Integer divisionNumber = 01; String addr1 = '2972 Anderson Circle SE'; Integer postalCode = 30080; String city = 'Smyrna'; String state = 'GA'; Integer phone1 = null; String contactMethod = 'Email'; String email = 'rlopez@rampartinsurance'; HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); // Login Variables String account = 'xxxx'; String username = 'xxxx'; String password = 'xxxx'; String serverpool = 'xxxx'; // Setting login variables - commented out to try raw xml //Blob headerValue = Blob.valueOf(Account + ':' + Username + ':' + Password + ':' + Serverpool); // Body of Request - XML in a string string soapBody = '<ClientImportRecord>' + '' + '<Guid>'+ Id + '</Guid>' + '' + '<ClientName>' + name + '</ClientName>' + '' + '</ClientImportRecord>'; string headerValue = '<Account>' + account + '</Account>' + '' + '<Username>' + username + '</Username>' + '' + '<Password>' + password + '</Password>' + '' + '<Accesscode xsi:nil="true" />' + '' + '<Serverpool>' + serverpool + '</Serverpool>'+ '' + '<Onlinecode xsi:nil="true"/>'; String authorizationHeader = headerValue; req.setHeader('Authorization', authorizationHeader); req.setHeader('Accept-Encoding','gzip,deflate'); req.setHeader('Content-Type', 'text/xml'); req.setHeader('SOAPAction','http://amsservices.com/clientInsert'); req.setEndpoint('http://xxx.xxx.xxx.xxx/sagittaws/transporter.asmx'); req.setMethod('POST'); req.setBody(soapBody); System.debug('Full XML' + soapBody); req.setCompressed(true); // otherwise we hit a limit of 32000 try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } } }
- Terminusbot
- June 13, 2016
- Like
- 0
- Continue reading or reply
What's wrong with this use of inputHidden?
I'm trying to fill a hidden custom field through a parameter provided via the URL in a Visualforce page on a Force.com site that creates leads. I'm getting the following error: "Error: Literal value is required for attribute id in apex:inputHidden in NomineeRegistration at line 38 column 99."
Here's my Apex:
And the highlights of the VF page:
Here's my Apex:
public class myWeb2LeadExtension { private final Lead weblead; public myWeb2LeadExtension(ApexPages.StandardController stdController) { weblead = (Lead)stdController.getRecord(); } public PageReference saveLead() { try { insert(weblead); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference p = Page.ThankYou; p.setRedirect(true); return p; }
And the highlights of the VF page:
<apex:page standardController="Lead" extensions="myWeb2LeadExtension" title="Register for Digital Accelerator" showHeader="false" standardStylesheets="true"> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > <apex:messages id="error" styleClass="errorMsg" layout="table" style="margin-top:1em;"/> <apex:pageBlock title="" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Submit" action="{!saveLead}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Register for Digital Accelerator" collapsible="false" columns="1"> <div class = "requiredInput"> <div class = "requiredBlock"></div> <apex:inputField value="{!Lead.FirstName}" required="true"/> <apex:inputField value="{!Lead.LastName}" required="true"/> <apex:inputField value="{!Lead.Nickname__c}" required="false"/> <apex:inputField value="{!Lead.Title}" required="true"/> <apex:inputField value="{!Lead.Email}" required="true"/> <apex:inputField value="{!Lead.Company}" required="true"/> <apex:inputField value="{!Lead.Phone}" required="true"/> <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/> </div> <apex:inputHidden id="{!Lead.Referred_By__c}" value="{!$CurrentPage.parameters.Referred"/> </apex:pageBlockSection> </apex:pageBlock>
- Will Edwards
- June 13, 2016
- Like
- 0
- Continue reading or reply
CRUC settings not availible for "Require TLS 1.1 or higher for HTTPS connections"
Hi,
I can't see "Require TLS 1.1 or higher for HTTPS connections" under Critical Update column. I am using free developer salesforce product.
My product is not able to integrate with SF because of the error
"
UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https."
When I googled it I found the resolution but that option is not availible under Critical Update setting.
Can anyine help?
I can't see "Require TLS 1.1 or higher for HTTPS connections" under Critical Update column. I am using free developer salesforce product.
My product is not able to integrate with SF because of the error
"
UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https."
When I googled it I found the resolution but that option is not availible under Critical Update setting.
Can anyine help?
- Subhrajit Das
- June 13, 2016
- Like
- 0
- Continue reading or reply