-
ChatterFeed
-
27Best Answers
-
3Likes Received
-
5Likes Given
-
31Questions
-
357Replies
Web2Lead form submission gets CORS error although I have whitelisted the domain
---
While the raw form looks like this
<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
I have built the form using some custom components in React and providing the below `handleSubmit` handler to it to submit the form.
const actionUrl = 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'; const handleSubmit = async (formValues) => { try { await axios.post(actionUrl, formValues, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); } catch (error) { console.error(error); } };
And this axios request is getting CORS error on the browser although I added the domain to the whitelist on the security settings.
Are Web2Lead forms intended to be submitted as a native form always? Is there a way to submit this form using axios without getting the CORS error?
- Chris Baboujian
- March 13, 2023
- Like
- 0
- Continue reading or reply
Create a Map from parent to grandchild
- Jason Voight
- February 10, 2023
- Like
- 0
- Continue reading or reply
How to write test class for map<object,object>collection object
How to write test class for map<object,object>collection object please have a look the below code
@AuraEnabled
public static String createContactRecords(List<Object> lstObjects) {
For(Object obj : lstObjects) {
Map<Object, Object> mapContact = (Map<Object,Object>)obj;
If(mapContact.get('type') == 'string' ||
mapContact.get('type') == 'text' ||
mapContact.get('type') == 'textarea' ||
mapContact.get('type') == 'url' ||
mapContact.get('type') == 'phone' ||
mapContact.get('type') == 'email'
) {
If(mapContact.get('value') != null && String.valueOf(mapContact.get('value')) != '') {
objContact.put(String.valueOf(mapContact.get('field')), String.valueOf(mapContact.get('value')));
}
}
}
test class-
@isTest
public class ContactFormHandler_Test {
@isTest
public static void test(){
Account acc= new Account();
acc.Name = 'test';
insert acc;
contact con = new Contact();
con.LastName = 'test1';
insert con;
List<object> objList = (List<object>)json.deserializeUntyped('[{"field": "FirstName","type": "string", "value": "tedf"},{"field":"LastName", "type":"string", "value":"hgghjh"}]');
ContactFormHandler.createContactRecords(objList);
It show error - System.TypeException: Invalid conversion from runtime type Map<String,ANY> to Map<ANY,ANY>
- priyanshu nema 2
- February 09, 2023
- Like
- 0
- Continue reading or reply
How do you auto complete a miilestone
https://help.salesforce.com/s/articleView?id=sf.entitlements_milestones_trigger.htm&type=5
Can you help me I have copied the apex class and trigger and still nothing works
- Ratheven Sivarajah
- February 08, 2023
- Like
- 0
- Continue reading or reply
Trigger whenever a record is inserted to the account automatically insert to the contact and throw error if contact is more than 5.
- Priyanka Dumka
- February 07, 2023
- Like
- 0
- Continue reading or reply
Write trigger that country (custom field) field of account object should get copied with the value of country(custom field) of contact object whenever a contact is created or account is updated
- Vethanbu Libertin
- February 07, 2023
- Like
- 0
- Continue reading or reply
I am trying to stick a entitlement to every new case getting created
- Ratheven Sivarajah
- February 06, 2023
- Like
- 0
- Continue reading or reply
Validation Rule Help - If a specific picklist value is chosen than a custom checkbox cannot be true
I am trying to create a rule that prevents users from checking off a checkbox if they choose specific values from a picklist.
The picklist for our logged calls is labeled Type, and if options A or B are chosen, they should not be able to check off a custom checkbox. That checkbox should only be able to be TRUE if any of the other types have been selected.
Can anyone help me nail this down?! Much appreciated!
- Matt Picher
- February 03, 2023
- Like
- 0
- Continue reading or reply
My first ever SOQL query? Works until I try and get the user name.
SELECT OwnerId, User.Name FROM Event, StartDateTime,Subject,Hotel__c,Activity__c,Notes__c, Done__c,Completed__c,Cancelled__c,Postponed__c
FROM Event
WHERE StartDateTime = LAST_MONTH
Any help much appreciated.
Thanks
- Tracy Bingham
- February 03, 2023
- Like
- 0
- Continue reading or reply
New to Salesforce Development and need help writing a test class for this Apex Class
global class ExportBackgroundCheckCompleteToGolden { @InvocableMethod(label='Export Background Check Completed Volunteers To Golden' description='Exports contacts who have completed their background check with Sterling Volunteers to Golden' category='Contact') public static List<Contact> BackgroundCheckCompleteToGolden(List<Contact> contacts) { List<Contact> exported = new List<Contact>(); if ((contacts == null) || (contacts.size() == 0)) { System.debug('No contacts'); return exported; } else { System.debug('There are ' + contacts.size() + ' contacts.'); } for (Contact contact: contacts) { if ((contact != null) && (contact.VVSA__VV_Status__c == 'Eligible')) { exported.add(contact); } } if (exported.size() > 0) { goldenapp.ExportToGoldenBatch.runSyncJob(exported, 'Background Check Completed'); } return exported; } }
- Austin Henson
- February 02, 2023
- Like
- 0
- Continue reading or reply
What does this PageReference method Do in my Apex Classes?
I took over support for an organization and in reviewing their previously written Apex Classes, a lot of them have this PageReference method stuck on at the end and I'm not completely sure what it is for. It's repetitive and many lines, so please forgive the longcat below.
Here's the whole method:
Public PageReference codecoverage() { if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} if(Test.isRunningTest()){} return null; }
The rest of the class code that is actually doing the work is contained in an if statement
if(!Test.isRunningTest()) { // code to do work here } else { system.debug('test'); }
Any ideas what this code structure and methods are for?
- Christopher Bahr 4
- February 02, 2023
- Like
- 0
- Continue reading or reply
Rerendering a visualforce page from apex controller implementing Database.Batchable
The controller is using the Database.batchable class to handle the rather large amount of records deleted or created in one go. This means that a simple Apex:ActionFunction to rerender the page isn't doing the trick, as the process triggered by the button is asyncronous and might complete only after several minutes.
I'm passing the controller object to the class that handles the batch calls, but I have not figured out a way to trigger via the page controller a rerendering of the page, once the batch processing is completed.
Any suggestions on how to achieve that?
- mwille64
- February 01, 2023
- Like
- 0
- Continue reading or reply
I am trying to use hover in my css but it's not working
<style type="text/css">
[id*=button] { background-color: white !important;
border: 1px solid black !important;
color: black !important;
text-decoration: none !important;
padding: 9px !important;
cursor: pointer !important;
}
[id*=button:hover] { background-color: white !important;
}
[id*=wrapper] {
margin: auto;
width: 50%;
text-align: center !important;
padding: 10px;
height: 100px !important;
}
</style>
<div id="wrapper">
<apex:repeat value="{!TechnologyProduct}" var="res" >
<apex:outputPanel rendered="{!res.Detail_Link__c != null}" layout='none'>
<apex:outputlink value="{!res.Detail_Link__c}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
</apex:outputPanel>
</apex:repeat>
</div>
</apex:page>
- Ratheven Sivarajah
- January 31, 2023
- Like
- 0
- Continue reading or reply
How to write the testclass for below code in Sample code in Salesforce
public class TargetPlanController { @AuraEnabled public static List <TargetPlan__c > fetchAccts(Id recordId) { return [SELECT Name,Account__c,No_of_Leads__c,AccountCity__c,FROM TargetPlan__c where BP_Id__c =: recordId ]; } }
How to write the Test Class for the Above code.. please let me know.
Thanks
Prathusha Reddy.
- salesforce sfdx
- January 31, 2023
- Like
- 0
- Continue reading or reply
How do you create a button when clicked will send you to that link
<apex:page controller="TechnologyProduct" lightningStylesheets="true">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection title="Vitality Check Attributes">
<apex:repeat value="{!TechnologyProduct}" var="res">
<apex:outputText value="{!res.Detail_Link__c}" /><br/>
<apex:commandButton value="{res.Detailed_Product_Name__c}"/>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
- Ratheven Sivarajah
- January 30, 2023
- Like
- 0
- Continue reading or reply
Return a a list from a controller and use it in a VF page
Controller:
public with sharing class TechnologyProduct {
public TechnologyProduct() {
List <Technology_Product__c> result = [SELECT Id, Name FROM Technology_Product__c where Account__c='00105000002oNIyAAM'];
}
}
- Ratheven Sivarajah
- January 30, 2023
- Like
- 0
- Continue reading or reply
flow in debug mode not working properly - id not acepted correctly
I am debugging flow.
I am providing input values as needed, like opportunity id, but it is not getting detected.
hwhat are the popentail reasons, please
- Ab
- January 30, 2023
- Like
- 0
- Continue reading or reply
How do you write css on a visual force-Page.
This is the code:
<apex:page controller="TestQuote" lightningStylesheets="true" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Quote Request Name:" for="name" ></apex:outputLabel>
<apex:outputField value="{!result.Quote_Request__r.name}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
- Ratheven Sivarajah
- January 29, 2023
- Like
- 0
- Continue reading or reply
Next Order Date should be Order Start date + 30
Written a batch class to creaet automatically order if the contract is Activated. When the Contract status is made activated at that time the Next order Date will display the immediate wednesday which is handled by flow.
I need to do an setup that when Order status will be Order Dispatched then the Next Order Date should display Order Start Date + 30 days or Order Start Date + 30 days (immediate wednesday).
Is it possible by flow If yes then how, if no then how we can achieve this.
Thanks
- Sudeep Singh
- January 26, 2023
- Like
- 0
- Continue reading or reply
Lead Scoring method based on locations
I am wondering if any best practices out there for lead scoring based on their geographical location other than creating custom formula field?
Thanks so much in advance.
- Nicole Chang_
- January 25, 2023
- Like
- 0
- Continue reading or reply
Eclipse Force.com IDE Help
Hi All,
Would it be possible to have an Validation Check in place or some kind of an pop-up asking "Are You Sure" before deploying code into Server?
Right Click on an eclipse Project --> Force.com-->Deploy to Server
Before Deploying to server, Do we have any option in Eclipse which we can enable to precheck. I have accidentally Hit on "Deploy to Server" rather than "Refresh from Server".
- Shri Raj
- May 13, 2015
- Like
- 0
- Continue reading or reply
Export Data from Salesforce in Tab Separated Values(TSV) format
Is there anyway out in Salesforce where we can export data in .TSV / Tab Separated Values? Can you kindly suggest some good tools from the market?
Thanks,
Shri
- Shri Raj
- October 02, 2014
- Like
- 0
- Continue reading or reply
BATCH class to Delete records from an Object which are created 10 Days ago from today.
Thanks
Shri
- Shri Raj
- September 15, 2014
- Like
- 1
- Continue reading or reply
Salesforce Integration with Elasticsearch. Authentication using Ping Identity
Hello All.
Here is the challenge which i need to implement and looking for a solution approach.
I need to implement a custom VF Page Search Functionality inside Salesforce. The Data is inside Elastic Search which is a open source Search & Analytic engine. The Elastic Search is inside our Company's network. I have the API to access using JSON & I'm able to do it using a REST based tool.
Now, Since Salesforce is outside our Company's network i need to authenticate using Ping Identity & then access Elastic Search API.
I'm really not sure about how this authentication works since the first call will be from Salesforce everytime. Can someone please help. I'm unsure if this will be using SSL or OAuth etc.
Thanks,
Shri.
- Shri Raj
- September 15, 2014
- Like
- 0
- Continue reading or reply
Send Email when Owner of the Campaign or Custom Object Changes.
Hello,
I would like to know if there is an email notification by default which would notifies the Users when the owner of that a particular record is assigned to them?
I see a default check box which can also be set false. But i want to keep it active. Any profile permissions?
Thanks,
Shri
- Shri Raj
- September 10, 2014
- Like
- 0
- Continue reading or reply
Upload CSV into Salesforce using JAVA.
Hello All,
I know we can upload a CSV into Salesforce using various different ways. I'm conducting a POC in my company to upload a CSV file into Salesforce using a JAVA program. Can someone please guide or provide any reference links?
Thanks,
Shri
- Shri Raj
- August 20, 2014
- Like
- 0
- Continue reading or reply
Displaying Picklist Values based on RecordType for End Users on VF Page.
One a VF Page, If a user only has access to RT1 then he/she is able to see only picklist values which are displayed for RT1.
One a VF Page, If a user only has access to RT2 then he/she is able to see only picklist values which are displayed for RT2.
If i add a permission set for a Users and give access to both the RecortyTypes RT1 & RT2, On the Visualforce Page its displaying all the picklist values and not by the Recordtype of that record.
Please guide
Shri
- Shri Raj
- August 13, 2014
- Like
- 0
- Continue reading or reply
REST API Call from Salesforce to In-House system.
What all are the things i need to consider before making this call to that system apart from the EndPoint.
Thanks
- Shri Raj
- August 13, 2014
- Like
- 0
- Continue reading or reply
Authentication in Salesforce.
Can someone explain what exactly is Authentication and how does it work in Salesforce for REST & SOAP based integrations. Please mention in simple terms.
Thanks
- Shri Raj
- August 13, 2014
- Like
- 0
- Continue reading or reply
REST API Authentication
- Shri Raj
- August 12, 2014
- Like
- 0
- Continue reading or reply
REST API Integration Issue. - System.HttpResponse[Status=Service Unavailable, StatusCode=503]
I will try to frame my question in short.
End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)
SUCCESS Through Chrome APP
1. All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct.
Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.
PROBLEM from Salesforce :
2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error.
System.HttpResponse[Status=Service Unavailable, StatusCode=503]
public with sharing class LmsRestApiIntegration {
//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.ccc.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.ccc.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.ccc.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();
System.debug('Response :'+response);
}
}
Please guide.
Thank You
Shri
- Shri Raj
- August 12, 2014
- Like
- 1
- Continue reading or reply
REST API Integration ERROR.
I will try to frame my question in short.
End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)
SUCCESS Through Chrome APP
1. All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct.
Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.
PROBLEM from Salesforce :
2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error.
System.HttpResponse[Status=Service Unavailable, StatusCode=503]
public with sharing class LmsRestApiIntegration {
//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.csaa.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.csaa.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.csaa.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();
System.debug('Response :'+response);
}
}
Please guide.
Thank You
Shri
- Shri Raj
- August 08, 2014
- Like
- 0
- Continue reading or reply
renderAs as XML Attachment in Salesforce. And Zip the Attachment.
1. Render data in an XML Attachment
2. Zip the attachment
3. Email the attachment. (I know we can do this)
Please guide
Thanks
Shri
- Shri Raj
- August 07, 2014
- Like
- 0
- Continue reading or reply
Can we render as XML Attachment in Salesforce? If we do, Can we Zip the Attachment?
1. Render data in an XML Attachment
2. Zip the attachment
3. Email the attachment. (I know we can do this)
Thanks
Shri
- Shri Raj
- August 07, 2014
- Like
- 0
- Continue reading or reply
Partially Inactivating 'Inline Edit' on a VF Page
Hello,
Is there any ways where i can Partially inactivate an Inline Edit. Here is the scenario.
Bascially i have a custom Related List which is a VF Page which supports an Inline Edit . I Also have a 'Mass Edit' button on the related list which opens up a 'Mass Edit' PageBlockSection. Whenever the Mass Edit button is clicked then i would like to inactivate the InlineEdit. Orelse keep it active.
Thanks,
Shri
- Shri Raj
- August 05, 2014
- Like
- 0
- Continue reading or reply
Error while parsing WSDL into Salesforce
I have been trying to parse an WSDL into Salesforce and im receiving the following error. Please help.
Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema
- Shri Raj
- August 04, 2014
- Like
- 0
- Continue reading or reply
Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema
Hello,
I was trying to Parse an XML into our Salesforce Dev org and I was getting this error. Kindly suggest what could be the problem.
Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema
Thanks,
Shri
- Shri Raj
- August 02, 2014
- Like
- 0
- Continue reading or reply
Dev to Uat Sandbox SOAP integration.
We are planning to have a integration from Salesforce to an External System. Salesforce --> Lead Management System. Here I'm not sure if this will be only SOAP or REST could also be possible.
Before i start working on this, I would like to Integrate both Salesforce DEV and Salesforce UAT. I have Parsed the WSDL from UAT into DEV where 3 of Apex classes are created. From here onwards I'm not sure how can i take it forward. Like, Passing the Credentials and inserting/updating data from Dev to UAT.
Kindly suggest.
Shri
- Shri Raj
- July 30, 2014
- Like
- 0
- Continue reading or reply
Error : Informatica Cloud Data Loader for Salesforce
Hello,
I have been getting this error. Since im using this free appliation for the first time online, It doest provide a free informatica support. Did anyof you face the same problem? What could be the problem?
Since im testing the app, My task is light weight. Im planning to insert 2 Account records from one Sandbox instance to another.
[FATAL] GetServerTimestamp failed. User [UserName]. Fault code [3]. Reason [SOAP Error : [Tag Error : MisMatch]. Please Contact Informatica Customer support.].
- Shri Raj
- July 29, 2014
- Like
- 0
- Continue reading or reply
List of Integers in Ascending/Descending order
I always get confused with indexing. I would like to print these numbers in Ascending & Descending order. Can someone help.
List<Integer> intergerList = new List<Integer> {33,2,45,343,433,22,111} ;
- Shri Raj
- July 28, 2014
- Like
- 0
- Continue reading or reply
BATCH class to Delete records from an Object which are created 10 Days ago from today.
Thanks
Shri
- Shri Raj
- September 15, 2014
- Like
- 1
- Continue reading or reply
REST API Integration Issue. - System.HttpResponse[Status=Service Unavailable, StatusCode=503]
I will try to frame my question in short.
End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)
SUCCESS Through Chrome APP
1. All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct.
Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.
PROBLEM from Salesforce :
2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error.
System.HttpResponse[Status=Service Unavailable, StatusCode=503]
public with sharing class LmsRestApiIntegration {
//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.ccc.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.ccc.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.ccc.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();
System.debug('Response :'+response);
}
}
Please guide.
Thank You
Shri
- Shri Raj
- August 12, 2014
- Like
- 1
- Continue reading or reply
Sorting NULL fields on Visualforce Page using Comparable Interface
Hello,
I have implemented Custom Sorting on a VF page using Comparable Interface. If there are 10 records in a Page and few of the fields on the records are NULL then the List.Sort method is not functioning properly when there are NULL and NOT NULL fields included. Please suggest.
Thanks
- Shri Raj
- May 28, 2014
- Like
- 1
- Continue reading or reply
Change button color in highlights panel
- ET 10
- April 18, 2023
- Like
- 0
- Continue reading or reply
How to unassign the Queue membership that is automatically assigned to the users when we are creating the user under the role that has user assigned to Queue?
- prem chand 19
- March 18, 2023
- Like
- 0
- Continue reading or reply
expecting a colon, found 'Datetime.now' (I facing error while comparing datetime )
public Database.queryLocator start(Database.BatchableContext BC)
{
return Database.getQueryLocator('Select Id, DeliveryStatus__c, Source__c, ScheduledAt__c, MessageText__c, ToNumber__c, FromNumber__c From MessageHistory__c where DeliveryStatus__c = \'Scheduled\' AND Source__c = \'Drip Campaign\' AND ScheduledAt__c <= Datetime.now()');
}
public void execute(Database.BatchableContext BC, List<MessageHistory__c> messagehistoryList ) {
for(MessageHistory__c mh : messagehistoryList) {
MessageDesk mD = new MessageDesk();
MessageInfo mi = new MessageInfo(mh);
mD.sendSMS(mi);
}
}
public void finish(Database.BatchableContext BC)
{
}
}
- Shubham Gawande 5
- March 18, 2023
- Like
- 0
- Continue reading or reply
Getting error - This page has an error. You might just need to refresh it. Action failed: c:ContactListSearch$controller$searchKeyChange [Cannot read properties of undefined (reading 'setParams')]
I am getting the following error -
This page has an error. You might just need to refresh it. Action failed: c:ContactListSearch$controller$searchKeyChange [Cannot read properties of undefined (reading 'setParams')] Failing descriptor: {c:ContactListSearch$controller$searchKeyChange}
while running the app with the following code.
QuickContacts.app
<aura:application>
<link href='/resource/bootstrap/' rel="stylesheet"/>
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">Lightning Contacts</a>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<c:ContactListSearch/>
<c:ContactList/>
</div>
</div>
</div>
</aura:application>
ContactList.cmp
<aura:component controller="ContactController">
<aura:attribute name="contacts" type="Contact[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:handler event="c:SearchKeyEvent" action="{!c.searchKeyChange}"/>
<ul class="list-group">
<aura:iteration items="{!v.contacts}" var="contact">
<li class="list-group-item">
<a href="{! '#contact/' + contact.Id }">
<p>{!contact.Name}</p>
<p>{!contact.Phone}</p>
</a>
</li>
</aura:iteration>
</ul>
</aura:component>
ContactListController.js
({
doInit : function(component, event)
{
var action=component.get("c.findAll");
action.setCallback(this,function(a)
{
component.set("v.contacts",a.getReturnValue());
});
$A.enqueueAction(action);
},
searchKeyChange: function(component, event) {
var searchKey = event.getParam("searchKey");
var action = component.get("c.findByName");
action.setParams({
"searchKey": searchKey
});
action.setCallback(this, function(a) {
component.set("v.contacts", a.getReturnValue());
});
$A.enqueueAction(action);
}
})
ContactListSearch.cmp
<aura:component >
<input type="text" class="form-control" placeholder="Search" onkeyup="{!c.searchKeyChange}"/>
</aura:component>
SearchKeyEvent.evt
<aura:event type="APPLICATION" access="global">
<aura:attribute name="searchKey" type="String"/>
</aura:event>
ContactListSearchController.js
({
searchKeyChange : function(component, event, helper) {
var myEvent = $A.get("e.c:SearchKeyChange");
myEvent.setParams({"searchKey":event.target.value});
myEvent.fire();
}
})
Can anyone please help me to find the error?
- DP Mishra
- March 17, 2023
- Like
- 0
- Continue reading or reply
Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions
I am trying to write SOQL for below case but facing issue "Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions".
Use case is to retreive the opportunity where Amount > 1000 (OR) OpportunityFieldHistory where FIELD='StageName' AND CreatedDate LAST_N_DAYS:14.
My Query:
SELECT Id, Name from opportunity where Amount > 1000 OR Id IN(SELECT OpportunityId from OpportunityFieldHistory WHERE Field='StageName' AND CreatedDate=LAST_N_DAYS:14))
Can you please help, how this can be acheived.
- vishnu nv
- March 14, 2023
- Like
- 0
- Continue reading or reply
test class error. email body missing field required
global class XYZLetter {
global static void sendLetter(List<String> recordId) {
//Get Files from ContentDocumentLink Object
List<ContentDocumentLink> cdls = [select Id,ContentDocumentId,ContentDocument.Title,LinkedEntity.Name From ContentDocumentLink where LinkedEntityId=:recordId AND ContentDocument.Title LIKE 'xyz%'];
Set<Id> contentDocumentIds = new Set<Id>();
for (ContentDocumentLink cdl : cdls) {
contentDocumentIds.add(cdl.ContentDocumentId);
}
List<Id> attachmentIds = new List<Id>();
//Get all related contentVersion file
List<ContentVersion> documents = ([SELECT Id FROM ContentVersion WHERE isLatest = true AND ContentDocumentId IN :contentDocumentIds]);
for (ContentVersion doc : documents) {
attachmentIds.add(doc.Id);
}
//Get details on the Application
Card__c pcard = [SELECT Id,Letter_Failed__c, RecordTypeId FROM Card__c WHERE Id=:recordId];
String cardholderContactId=pcard.Card_Applicant__c;
//-********************
if(attachmentIds.size()==0){
EmailTemplate NoXYZ = [SELECT id FROM EmailTemplate WHERE developerName = 'Letter_Not_Found'];
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'oxyxSF@COMPANY.COM'];
String[] ccAddresses = new String[] {'cardinquiries@company.com'};
//Apex Single email message
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
if ( owea.size() > 0 ) {
mail.setOrgWideEmailAddressId(owea.get(0).Id);
}
mail.setTemplateID(NoXYZ.id);//templateID
mail.setTargetObjectId(cardholderContactId);// contact Id of cardholder
mail.setCcAddresses(ccAddresses);
//No attachment found here, so no need to try and attach mail.setEntityAttachments(attachmentIds);
mail.setWhatId(pcard.Id);
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {mail};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
if (results[0].success) {
System.debug('The email for XYZ Letter not found was sent successfully.');
} else {
System.debug('The email for XYZ Letter not found failed to send: '+ results[0].errors[0].message);
pcard.XYZ_Letter_Failed__c = true;
}
Update pcard;
}//end if attachmentIds.size()==0 (Send 'XYZ Letter Not Found' Template end)
//-********************
//-********************
//Otherwise, end message as expected
else {
Id pcardRTypeId = [SELECT Id FROM RecordType WHERE sObjectType='Card__c' AND developerName ='PCard_Approval'].Id;
Id finRTypeId = [SELECT Id FROM RecordType WHERE sObjectType='Card__c' AND developerName ='Information_Updates'].Id;
EmailTemplate pcardET = [SELECT id FROM EmailTemplate WHERE developerName = 'X3_Approved'];
EmailTemplate finET = [SELECT id FROM EmailTemplate WHERE developerName = 'X20_Information_Update_Approved'];
EmailTemplate SingleFinET = [SELECT id FROM EmailTemplate WHERE developerName = 'X201_Single_Information_Update_Approved'];
EmailTemplate MonthlyFinET = [SELECT id FROM EmailTemplate WHERE developerName = 'X202_Monthly_Information_Update_Approved'];
String et;
if (pcard.RecordTypeId == pcardRTypeId){
et = pcardET.Id;
}
else if (pcard.RecordTypeId == finRTypeId){
//et = finET.Id;
if (pcard.Monthly_Purchase_Card_Update__c && pcard.Single_Purchase_Card_Update__c){
et = finET.Id;
}
else if(pcard.Monthly_Purchase_Card_Update__c){
et = MonthlyfinET.Id;
}
else if(pcard.Single_Purchase_Card_Update__c){
et = SingleFinET.Id;
}
}
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'XYZsalesforce@COMPANY.COM'];
String[] ccAddresses = new String[] {'p-cardinquiries@COMPANY.COM'};
if (pcard.PCard_Supervisor__c != null){
ccAddresses.add(pcard.PCard_Supervisor__c);
}
if (pcard.Approving_Official_Lookup__c != null){
ccAddresses.add(pcard.Approving_Official_Lookup__c);
}
List<String> idList = new List<String>();
Group g = [SELECT (select userOrGroupId from groupMembers) FROM group WHERE NAME =:pcard.CPublic_Group__c];
for (GroupMember gm : g.groupMembers) {
idList.add(gm.userOrGroupId);
}
User[] usr = [SELECT email FROM user WHERE id IN :idList];
for(User u : usr) {
ccAddresses.add(u.Id);
}
//Apex Single email message
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
if ( owea.size() > 0 ) {
mail.setOrgWideEmailAddressId(owea.get(0).Id);
}
mail.setTemplateID(et);//templateID
mail.setTargetObjectId(cardholderContactId);// contact Id of cardholder
mail.setCcAddresses(ccAddresses);
mail.setEntityAttachments(attachmentIds);
mail.setWhatId(pcard.Id); // card recordId
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {mail};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
if (results[0].success) {
System.debug('The email was sent successfully.');
} else {
System.debug('The email failed to send: '+ results[0].errors[0].message);
}
}
Here is the test class:
@isTest
public class DPALetterTest {
static testMethod void sendEmailwithAttachment() {
Test.startTest();
EmailTemplate et = [SELECT id FROM EmailTemplate WHERE developerName = 'X3_PCard_Approved'];
Id pcardRTypeId = [SELECT Id FROM RecordType WHERE sObjectType='PCard__c' AND developerName ='PCard_Approval'].Id;
Id finRTypeId = [SELECT Id FROM RecordType WHERE sObjectType='Purchase_Card__c' AND developerName ='Information_Updates'].Id;
// String pcardRTypeId = recTypeId.Id;
Account acc = new Account();
acc.Name='ABCTest';
insert acc;
String profileName1 = 'Card Application User';
User admin = [SELECT Id, Username, UserRoleId FROM User WHERE Profile.Name = 'System Administrator' AND UserRole.Name='XYZSystem Admin' LIMIT 1];
System.runAs(admin){
User u1 = new User(
ProfileId = ([SELECT Id FROM Profile WHERE Name=:profileName1].Id),
LastName = 'user1',
Email = 'test.user1@test.com',
Username = 'test.ccpuser1@test.com',
CompanyName = 'XYZ',
Alias = 'alias',
TimeZoneSidKey = 'America/Los_Angeles',
EmailEncodingKey = 'UTF-8',
LanguageLocaleKey = 'en_US',
LocaleSidKey = 'en_US'
);
insert u1;
User u2 = new User(
ProfileId = ([SELECT Id FROM Profile WHERE Name=:profileName1].Id),
LastName = 'user2',
Email = 'test.user2@test.com',
Username = 'test.ccpuser2@test.com',
CompanyName = 'CBER',
Alias = 'alias',
TimeZoneSidKey = 'America/Los_Angeles',
EmailEncodingKey = 'UTF-8',
LanguageLocaleKey = 'en_US',
LocaleSidKey = 'en_US'
);
insert u2;
Group gp = [SELECT ID FROM Group WHERE Name='PCard XYZ CCP Group'];
GroupMember gpm = new GroupMember();
gpm.GroupId = gp.Id;
gpm.UserOrGroupId = u1.Id;
Database.insert(gpm);
Contact applicant1 = new Contact(firstName='test', lastName = 'applicant11',accountId=acc.id, email ='test.applicant11@abctest.com');
insert applicant1;
Contact supervisor1 = new Contact(firstName='test', lastName = 'supervisor12',accountId=acc.id, email ='test.supervisor12@abctest.com');
insert supervisor1;
Contact ao1 = new Contact(firstName='test', lastName = 'ao11',accountId=acc.id, email ='test.ao11@abctest.com');
insert ao1;
Card__c app1 = new Card__c();
app1.RecordTypeId = pcardRTypeId;
app1.Cardholder_Name__c = 'Test Applicant11';
app1.Cardholder_Email_Address__c='Test.Applicant11@abctest.com';
app1.PCard_Applicant__c = applicant1.Id;
app1.PCard_Supervisor__c = supervisor1.Id;
app1.Approving_Official_Lookup__c = ao1.Id;
insert app1;
Purchase_Card__c app2 = new Purchase_Card__c();
app2.RecordTypeId = finRTypeId;
app2.Cardholder_Name__c = 'Test Applicant11';
app2.Cardholder_Email_Address__c='Test.Applicant11@abctest.com';
app2.Card_Applicant__c = applicant1.Id;
app2.Card_Supervisor__c = supervisor1.Id;
app2.Approving_Official_Lookup__c = ao1.Id;
insert app2;
// Insert Salesforce Files using Apex Class:
//Create Document
ContentVersion cv = new ContentVersion();
cv.Title = 'XYZ Test Document';
cv.PathOnClient = 'TestDocument.pdf';
cv.VersionData = Blob.valueOf('Test Content');
cv.IsMajorVersion = true;
Insert cv;
//Get Content Documents
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:cv.Id].ContentDocumentId;
//Create ContentDocumentLink
ContentDocumentLink cdl = New ContentDocumentLink();
cdl.LinkedEntityId = app1.Id;
cdl.ContentDocumentId = conDocId;
cdl.shareType = 'V';
cdl.Visibility = 'AllUsers';
Insert cdl;
ContentDocumentLink cdl2 = New ContentDocumentLink();
cdl2.LinkedEntityId = app2.Id;
cdl2.ContentDocumentId = conDocId;
cdl2.shareType = 'V';
cdl2.Visibility = 'AllUsers';
Insert cdl2;
Integer emailbefore = Limits.getEmailInvocations();
List<String> recordIds=new List<String>{app1.Id};
List<String> finRecordIds=new List<String>{app2.Id};
XYZLetter.sendLettXYZer(recordIds);
XYZLetter.sendXYZLetter(finRecordIds);
system.assertNotEquals(emailbefore,Limits.getEmailInvocations(),'should have decreased');
Test.stopTest();
}
}
}
- Dev Always
- March 14, 2023
- Like
- 0
- Continue reading or reply
Web2Lead form submission gets CORS error although I have whitelisted the domain
---
While the raw form looks like this
<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
I have built the form using some custom components in React and providing the below `handleSubmit` handler to it to submit the form.
const actionUrl = 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'; const handleSubmit = async (formValues) => { try { await axios.post(actionUrl, formValues, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); } catch (error) { console.error(error); } };
And this axios request is getting CORS error on the browser although I added the domain to the whitelist on the security settings.
Are Web2Lead forms intended to be submitted as a native form always? Is there a way to submit this form using axios without getting the CORS error?
- Chris Baboujian
- March 13, 2023
- Like
- 0
- Continue reading or reply
Joined Report for Custom Objects
- Bryn Jones
- March 13, 2023
- Like
- 0
- Continue reading or reply
Einstein Article Recommendations
- Heena Patel 19
- March 13, 2023
- Like
- 0
- Continue reading or reply
Is there any way to bypass lookup filter validation for specific user ?
- Narayana Reddy 30
- March 13, 2023
- Like
- 0
- Continue reading or reply
Formula to compare if Month/Day only are in between a range of month/day only
I am trying to write several formulas to use in a flow to check if a date is in between a range. The issue is I want it to be sustainable and only compare the Month and Day only, not the year.
Example:
say the input date field is March 1, 2023
I want to know if it's equal to or greater than January 11 and less than or equal to April 10th and not include the year.
Is this possible?
Tried something like this and it failed:
AND(
MONTH({!$Record.Comp_Approved_Date__c}) >= 1,
MONTH({!$Record.Comp_Approved_Date__c}) <= 4,
DAY({!$Record.Comp_Approved_Date__c}) >= 11,
DAY({!$Record.Comp_Approved_Date__c}) <= 10
)
- Julia Zocolo
- March 09, 2023
- Like
- 0
- Continue reading or reply
How can I get the access token using oauth?
Thanks
- Gaurav Dhandre
- March 09, 2023
- Like
- 0
- Continue reading or reply
I am unable to update standardvalueset through tooling api and here's request body but receiving bad id 4 and malformed id
I am unable to update [patch] standardvalueset through tooling api and here's request body but receiving bad id 4 and malformed id
Request Body:
{
"Metadata" : {
"sorted" : false,
"standardValue" : [ {
"allowEmail" : null,
"closed" : null,
"color" : null,
"converted" : null,
"cssExposed" : null,
"default" : false,
"description" : null,
"forecastCategory" : null,
"groupingString" : null,
"highPriority" : null,
"isActive" : null,
"label" : "Agriculture",
"probability" : null,
"reverseRole" : null,
"reviewed" : null,
"urls" : null,
"valueName" : "Agriculture",
"won" : null
}, {
"allowEmail" : null,
"closed" : null,
"color" : null,
"converted" : null,
"cssExposed" : null,
"default" : false,
"description" : null,
"forecastCategory" : null,
"groupingString" : null,
"highPriority" : null,
"isActive" : null,
"label" : "Chemicals1",
"probability" : null,
"reverseRole" : null,
"reviewed" : null,
"urls" : null,
"valueName" : "Chemicals1",
"won" : null
} ],
"urls" : null
},
"FullName" : "Test",
"MasterLabel" : "Test"
}
- user sso1
- March 08, 2023
- Like
- 0
- Continue reading or reply
generate csv file using apex
public class UserService {
private static String profileName = 'Chatter Free User';
private static String ps7Name = 'Test Chatter Free7';
Public static List<UserDetail> userDetailList = new List<UserDetail>();
private static List<String> ps1_ps10NameList = new List<String>{
'Test Chatter Free1','Test Chatter Free2','Test Chatter Free3','Test Chatter Free4','Test Chatter Free5','Test Chatter Free6','Test Chatter Free7','Test Chatter Free8','Test Chatter Free9','Test Chatter Free10'};
public static List<UserDetail> getUserPermissionDetails(){
Map<Id, User> userMap = new Map<Id, User>([SELECT Id
FROM User
WHERE Profile.Name = :profileName and Id IN (SELECT AssigneeId
FROM PermissionSetAssignment
WHERE PermissionSet.label = :ps7Name and PermissionSet.IsOwnedByProfile =false)]);
//System.debug(usermap);
Map<Id, List<String>> permissionSetMap = new Map<Id, List<String>>();
for(PermissionSetAssignment psa : [SELECT AssigneeId, PermissionSet.label
FROM PermissionSetAssignment
WHERE AssigneeId = : userMap.keySet()
AND (PermissionSet.label IN :ps1_ps10NameList
OR PermissionSet.label NOT IN :ps1_ps10NameList)and PermissionSet.IsOwnedByProfile =false
ORDER BY AssigneeId, PermissionSet.label])
{
List<String> tempList = new List<String>();
if(permissionSetMap.containsKey(psa.AssigneeId))
tempList = permissionSetMap.get(psa.AssigneeId);
tempList.add(psa.PermissionSet.label);
permissionSetMap.put(psa.AssigneeId, tempList);
}
return evaluateUser(permissionSetMap);
}
private static List<UserDetail> evaluateUser(Map<Id, List<String>> permissionSetMap){
Boolean additional;
List<UserDetail> userDetailList = new List<UserDetail>();
List<String> foundList = new List<String>();
for(Id id : permissionSetMap.keySet())
{
UserDetail ud = new UserDetail();
additional = false;
/*system.debug(permissionSetMap.get(id));*/
foundList.clear();
for(String str : permissionSetMap.get(id)){
if(!ps1_ps10NameList.contains(str)){
additional = true;
}else{
foundList.add(str);
}
/*system.debug(userDetailList);*/
}
ud.Id = id;
ud.permissionSetList = permissionSetMap.get(id);
if(additional && ps1_ps10NameList.size() == foundList.size())
ud.status = 'No Change And Additional';
else if(additional && ps1_ps10NameList.size() != permissionSetMap.get(id).size())
ud.status = 'Missing And Additional';
else if(!additional && ps1_ps10NameList.size() != foundList.size())
ud.status = 'Missing';
else if(!additional && ps1_ps10NameList.size() == foundList.size())
ud.status = 'No Change';
userDetailList.add(ud);
}
System.debug(JSON.serializePretty(userDetailList));
return userDetailList;
}
public class UserDetail {
public Id id;
public List<String> permissionSetList;
public String status;
}
}
- KRITI LAHA 8
- March 08, 2023
- Like
- 0
- Continue reading or reply
covert string to integer this list
public static void apexMethod(string a)
{
String[] arr=new String[]{'A','B','C','D','A'};
integer s1=integer.valueOf(arr);
System.debug( 'intVal value is ' + s1 );
error: Method does not exist or incorrect signature: void apexMethod() from the type ApexCollection.
I am getting error on this code, please response.
- sweta kumari 55
- February 16, 2023
- Like
- 0
- Continue reading or reply
Displaying wrong From email address while replying email
- Raghava Gupta Gokavarapu (IT Suppo
- February 15, 2023
- Like
- 0
- Continue reading or reply
No DefaultTerritoryAccountAccess field on Organization
"errorCode":"INVALID_FIELD","error_description":"","message":"\nDefaultLeadAccess, DefaultOpportunityAccess, DefaultTerritoryAccountAccess FROM\n ^\nERROR at Row:1:Column:125\nNo such column 'DefaultTerritoryAccountAccess' on entity 'Organization'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
- Mateo Davis
- February 14, 2023
- Like
- 0
- Continue reading or reply
Composite Graph API CollateSubrequests
Hope all is fine for you. I'm working on Integrations between ERP and Salesforce and willing to use Composite Resources to transfer Orders from our ERP to Salesforce.
Issue is that, even if it works most of the time, I'm having issues when Order contains more than X number of lines as Composite API allows up to 25 Subrequests only. I then discovered the Composite Graph API which raised this limit to 500, which was then pretty much OK, until I figured out that my subrequests were not executed in Order. Looking into documentation, I found the CollateSubrequests parameter, but this one seems to be only available in Composite API (back to the limit of 25 subrequests).
Does anybody know if there is a way to guarantee the order of execution for my subrequests in a Composite Graph API (for some Business reasons, I have to respect this order of execution which requires me to update the Order first (to Unlock it), then Delete Some Order Lines (which has to happen before I change the Currency on the Order), then Update the Order again (for currency), then re-Insert my Order Lines, then finally update my Order (to Lock it back).
Thanks in advance for your advices here
Cédric
- Cedric Marfil
- February 14, 2023
- Like
- 0
- Continue reading or reply
Logic Building - Between Parent child Object - Kind of Searching - sorting
Train and Coach are 2 objects. Where I need to build logic based on train schedule and availibility. From UI side admin can add the coach to the train.
Train (Parent Object - From, To, Timings)
Coach (Child Object - From, To, Timings) Field is there.
Now from UI side when user book the tickets. based on given 3 fields I need to add coachs in the train. lets say next week on monday there will 3 trains are schedule from X to Y location. now today we see many passanger book the train from X to Y location. so basically, based on timings I need to add number of coaches in next week train so I can accomodate all customers. Its not like 1 train run with 5-6 coach, while other train runs with 30-35 coach. there has to balance.
Please let me know if need further clarification in scenario.
- Kristiana Granger
- February 13, 2023
- Like
- 0
- Continue reading or reply
Limitation with addAll and sObject Lists
I'll show by example:
Account a = new Account(); sObject s LIST<sObject> sOjbList = new LIST<sObject>(); sOjbList.add(s); sOjbList.add(a);That works perfectly fine, as you'd expect.
sObject s1; sObject s2; LIST<sObject> sList = new LIST<sObject>{s1, s2}; LIST<sObject> sOjbList = new LIST<sObject>(); sOjbList.addAll(sList);Also works fine.
This, however, will fail.
LIST<Account> aList = new LIST<Account>{new Account(), new Account()}; LIST<sObject> sOjbList = new LIST<sObject>(); sOjbList.addAll(aList);It gives the errors:
Incompatible argument type LIST for All method on LIST
OR
Incompatible argument type LIST<Account> for All method on LIST<SObject>
(Based on if you're using the Developer Console or something else, like MavensMate)
But don't fret, there's a solution (albeit a silly one)
private LIST<sObject> objToSobj(sObject[] objList) { return objList; }That's right, pass your objList through this (and it will let you without problem) and all works fine.
Thoughts?
- ScriptMonkey
- July 25, 2014
- Like
- 2
- Continue reading or reply
Inline editing error: “Value cannot exceed 0 characters”
<apex:page standardController="Product_Assignment__c" tabStyle="Product_Assignment__c" extensions="TestInlineEditControllerExt"> <apex:form id="productForm"> <apex:pageBlock > <apex:pageMessages /> <apex:pageBlockTable value="{!productAssignments}" var="productAssignment"> <apex:column headerClass="h1"> <apex:facet name="header">Start Date</apex:facet> <apex:outputField value="{!productAssignment.Start_Date__c}"> <apex:inlineEditSupport changedStyleClass="dirtyField" event="ondblclick" showOnEdit="saveChanges" /> </apex:outputField> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:commandButton id="saveChanges" reRender="productForm" action="{!quicksave}" value="Save Changes" styleClass="saveChangesButton" /> </apex:form> </apex:page>The custom controller is (this is not my exact code, but it's enough to replicate the issue):
public with sharing class TestInlineEditControllerExt { public List<Product_Assignment__c> productAssignments { get; set; } public TestInlineEditControllerExt(ApexPages.StandardController stdController) { stdController.addFields(new List<String> { 'Start_Date__c' }); productAssignments = new List<Product_Assignment__c> { (Product_Assignment__c)stdController.getRecord() }; } }This works well in normal use cases. If I edit the field an input a deliberately incorrect value (like 'abcdef'), and press save, I receive the expected error: Start Date: Invalid Date and Time.
After this, if I attempt to click the revert button and save again, I receive a cryptic error message: Start Date: Value cannot exceed 0 characters.
I've tried following this pattern on a standard detail page, but this issue only seems to happen on my custom visualforce page. I've also tried using a custom action (instead of "quicksave") on my controller, but have the same issue (error message, controller is never called). We do not have any validation rules in place for this field.
Does anybody know why this error is happening and how I can fix this issue? It seems to only happen when I have an inline editing component inside of an apex:pageBlockTable or apex:repeat element.
- Brendan Conniff
- June 23, 2014
- Like
- 1
- Continue reading or reply
Announcing New Salesforce Developers Discussion Forums
Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums. With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site. By the way, it’s also mobile-friendly.
We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away. You’ll also have a great new user profile page that will highlight your community activity. Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.
This is, of course, only the beginning — and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before. Be sure to share any feedback, ideas, or questions you have on this forum post.
Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
- Lauren Grau
- December 22, 2013
- Like
- 58
- Continue reading or reply
Show Some Love
As many of you have discovered, our developer community is awesome. The wealth of knowledge here is phenomenal. This is an all volunteer community and people who take the time to help and post answers do so totally on their own initiative. With that said when someone provides the right answer to your question please take the time to mark their answer as the accepted solution. Also give them a kudos if they've really gone the extra mile to help out. Show some love ;)
- ryanjupton
- July 03, 2013
- Like
- 19
- Continue reading or reply
Issue with log level on APEX Data Loader 27.0.1
I recently downloaded APEX Data Loader version 27.0.1. My colleague has a batch job that does a bulk upload of records to our salesforce account. I tried running the script on my computer and kept getting an error. I narrowed down the culprit to be the output of the command line when running encrypt.bat.
When running the command line prompt "ecrypt.bat -g seed_text_here", the script is expecting the output to be just the key that should be saved to key.txt. This is consistent with the online video tutorial located here: http://www.salesforce.com/_app/video/data_loader/help/data_loader_cli.jsp
However, when I run "ecrypt.bat -g seed_text_here" on my computer, I get the following output:
2013-04-24 15:06:21,050 INFO [main] security.EncryptionUtil main (EncryptionUtil.java:304) - encrypted_password_key_here
It appears to be an issue with setting the logging level. Any ideas on how to change this?
Thanks.
- wtm17
- April 24, 2013
- Like
- 1
- Continue reading or reply