• SSP Admin
  • 4 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 27
we are trying to upsert the contact in a method and then upsert/update the same contact with external id

upserting the contact and updating in the same transaction

System.DmlException: Upsert failed. First exception on row 2; first error: INVALID_FIELD, Foreign key external ID:

concurrency issue 

Tried FutureMethod Not Wroking inbetween there are callouts also any solution please
Hello Stars!

I am facing an integration between Workday HCM and Salesforce.com.

Here are the Use Cases for the integrations required by Client:
a) when an Employee leaves the company, Workday should trigger a process sending information to Salesforce so as to de-activate the Salesforce User and stop paying for its Salesforce license; (we can start with a semi-automated/manual process).

b) when a new Candidate is "on-boarding" the company, i.e. a new Employee is created into Workday, this system should trigger a process to send information to Salesforce in order to create a User in Salesforce and possibly create a Case (to end setting up the new User).

1) Do you know if Workday has/offers a "Out-of-the-box" connector that would facilitate the solution?

2) If no connector available, which Solutio design would you recommend?

3) What LoE (Level of Effort) would you estimate for each of the above mentioned Use Cases?

Thank you very much.

I would like to automatically update categories when creating an Article.
When creating a Known Error article. 
User-added imageI would like the catgories to be automatically updated to known error categories.
User-added image
At the moment, I have to do it manually.
User-added imageAnyone has an Idea on how I could go about automating the process?
I have a problem. On page layuot I have 3 components:
- component A is a Lightning component
- component B is web component
- component C is lightning component
Component A lodas only 5 records
Component B loads 500 records
Component C loads 30 records.
The problem is when component B loads records, I can do nothing in component A and C until component B finishes data loading.
How to solve this problem?
Hey folks, I have requirement pls help me.

I have menu bar with items in it in classic , all the items in it are basically other system tabs.When ii click on them, new sub tab will open and show the information of another system. It works fine in classic.
in VF, sfoce.console.getfocusedsubtabid  & sforce.console.openSubTab is used.

Now I will have to migrate this vf page.Could not do with existing vf code.

So i have started creating lightning component.On click , i have to write controller , referring this below code to do so.

02    openTabWithSubtab : function(component, event, helper) {
03        var workspaceAPI = component.find("workspace");
04        workspaceAPI.openTab({
05            url: '/lightning/r/Account/001xx000003DI05AAG/view',
06            focus: true
07        }).then(function(response) {
08            workspaceAPI.openSubtab({
09                parentTabId: response,
10                url: '/lightning/r/Contact/003xx000004Ts30AAC/view',
11                focus: true
12            });
13        })
14        .catch(function(error) {
15            console.log(error);
16        });
17    }

But in my case I am confused what should I pass under workspace.openTab   &  workspaceAPI.openSubtab, bcz I dont have URL and things like that.
 can anyone of you suggest me.

OR can anyone suggest me how to use existing vf code and make it working in lightning, bcz this would be easy task
I have 1 VF page with lookup & "Done" command button
i have requirement of by clicking done button it will navigate to aura component & show data of that record to component
<apex:page standardController="Account">
    <apex:pageBlock title="Edit Account">
        <apex:pageBlockSection columns="2">
            <apex:inputField value="{!Account.owner.name}"/>
            <apex:inputField value="{!Account.name}"/>  
            <apex:inputField value="{!Account.Parentid}"/>
            <apex:inputField value="{!Account.AccountNumber}"/>
            <apex:inputField value="{!Account.Site}"/>
            <apex:inputField value="{!Account.Type}"/>
            <apex:inputField value="{!Account.Industry}"/>
            <apex:inputField value="{!Account.Rating}"/>
            <apex:inputField value="{!Account.Phone}"/>
            <apex:inputField value="{!Account.Fax}"/>
            <apex:inputField value="{!Account.Website}"/>
            <apex:inputField value="{!Account.TickerSymbol}"/>
            <apex:inputField value="{!Account.Ownership}"/>
            <apex:inputField value="{!Account.NumberOfEmployees}"/>
            <apex:inputField value="{!Account.Sic}"/>
            <apex:commandButton action="{!save}" value="Save"/>        

    <apex:pageBlock title="Contacts">
        <apex:pageBlockSection title="Related Lists">
                 <apex:pageBlockTable value="{!Account.Contacts}" var="Contact" >
                         <apex:outputLink value="{!URLFOR($Action.Contact.Edit, contact.Id)}">
                        <apex:outputLink value="{!($Action.Contact.Delete, contact.Id)}">
                     <apex:column value="{!Contact.Name}"/>  
                     <apex:column value="{!Contact.Email}"/>
                     <apex:column value="{!Contact.Title}"/>
                     <apex:column Value="{!Contact.Phone}"/>


I have created a page for a account and its related list. Related list will have a link for edit and delete contact also. But  I am facing an error can you please help me to resolve this error.
The error is: Unknown property 'AccountStandardController.contact'
I have created a metadata type with this field "DMS End Point"(DMS_End_Pint__c) and created 3 different records.

For 2 records 'DMS End Point' is same and for 1 record 'DMS End Point' is different.

Right now the code is written for create json for all records. But my requirement is that, i want to create a seprate JSON for seprate "DMS End point". For now only 2 json should be created, 1 for same 2 records and another for 1 record. But there can be N number of same or different end point records so it should be dynamic.

Here is my code
public class DMSIntegration {

List<DMS_Integration__mdt> lstMataData= new list<DMS_Integration__mdt>();
list<DMS_Integration__mdt> ListEndPoint= new list<DMS_Integration__mdt>();
Map<String, String> fieldMap = new Map<String, String>();
String sObjectFields = '';
String jsonData = '';

   // The no argument constructor 
  public void DMSIntegration() {
      // more code here
  //Read the DMS table and need to write the dynamic query
  public void readDMSTable() {
//Access Metadata
//lstMataData= [Select Child_Name__c, DMS_End_Pint__c, DMS_Field_Name__c, DMS_Table_Name__c, Object_Name__c, Salesforce_Field_API__c, Salesforce_Field_name__c from DMS_Integration__mdt];

//Getting the fields information
 Map<String, Schema.sObjectField> sObjectFieldMap = DMS_Integration__mdt.sObjectType.getDescribe().fields.getMap(); 
 //Map key is the field API name and value is the field data type.
                for(Schema.SObjectField sfield: sObjectFieldMap.Values()){
                    Schema.DescribeFieldResult fieldDesc = sfield.getDescribe();
                    fieldMap.put(fieldDesc.getName(), fieldDesc.getType().name());
 //Create query with all fields
                for(String field: fieldMap.keySet()){
                    sObjectFields += field+',';
                sObjectFields = sObjectFields.removeEnd(',');
                //Execute the SOQL query
                lstMataData = Database.Query('SELECT '+ sObjectFields +' from DMS_Integration__mdt');

system.debug('List of MetaData' +lstMataData);

  //Need to write the jason in this
  public void createJSON() {
 if(lstMataData!=null || !lstMataData.isEmpty()) {
  //Create JSON
                JSONGenerator gen = JSON.createGenerator(true);
                for(DMS_Integration__mdt OrderList :lstMataData ) {
                for(String field: fieldMap.keySet()){
                    if(OrderList.get(field) != null){
                        gen.writeStringField(field, String.ValueOf(OrderList.get(field)));
                        gen.writeStringField(field, '');
                //Getting the JSON String Data
                jsonData = gen.getAsString(); 
     //UseCase 2
    JSONGenerator genLineItem = JSON.createGenerator(true);
    for(DMS_Integration__mdt OrderList :lstMataData){
        genLineItem.writeStringField('Object Name', OrderList.Object_Name__c);
        genLineItem.writeStringField('Salesforce Field API', OrderList.Salesforce_Field_API__c);
        genLineItem.writeStringField('Salesforce Field name', OrderList.Salesforce_Field_name__c);
        genLineItem.writeStringField('Child Name', OrderList.Child_Name__c);
        genLineItem.writeStringField('DMS End Point', OrderList.DMS_End_Pint__c);
        genLineItem.writeStringField('DMS Field Name', OrderList.DMS_Field_Name__c);
        genLineItem.writeStringField('DMS Table Name', OrderList.DMS_Table_Name__c);
    String jsonDataLineItem = genLineItem.getAsString();
    System.debug('jsonData-' + jsonDataLineItem);

Hi there,

Is any one can help me, How can i integrate spreadsheet with salesforce using rest api.

Laxmi narayan
Create a new custom field of type checkbox on account,contact and lead named as ‘SDR Credit’ and new number field ‘Number of SDR Contacts/Leads’ on account and lookup field for Account named as ‘Matching Account’ on leads. So the logic here is that whenever a task under a contact/lead is created with type ‘Call’ and another task of type ‘Meeting’ is logged under same contact/lead within 180 days o
  • May 11, 2020
  • Like
  • 0
I have operating hours/time slots for one service territory as below  

Monday        9:00 AM    7:00 PM    Normal 11-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 12-05-2020
Wednesday    9:00 AM    7:00 PM    Normal 13-05-2020
Thursday    9:00 AM    7:00 PM    Normal 14-05-2020
Friday        9:00 AM    7:00 PM    Normal 15-05-2020
Saturday    9:00 AM    7:00 PM    Normal 16-05-2020
Sunday        9:00 AM    7:00 PM    Normal 17-05-2020

I can see the same time slots while booking service appointment for next 15 days from today

But I want to show this week Wednesday (13-05-2020) and Thursday (14-05-2020) time slots as Emergency hours and upcoming Wednesday and Thursday as normal hours.
Is it possible through configuration or code?

Monday        9:00 AM    7:00 PM    Normal 11-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 12-05-2020
Wednesday  11:00 AM 4:00 PM    Emergency 13-05-2020
Thursday   11:00 AM 4:00 PM Emergency 14-05-2020
Friday        9:00 AM    7:00 PM    Normal 15-05-2020
Saturday    9:00 AM    7:00 PM    Normal 16-05-2020
Sunday        9:00 AM    7:00 PM    Normal 17-05-2020
Monday        9:00 AM    7:00 PM    Normal 18-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 19-05-2020
Wednesday    9:00 AM    7:00 PM    Normal 20-05-2020
Thursday    9:00 AM    7:00 PM    Normal 21-05-2020
Friday        9:00 AM    7:00 PM    Normal 22-05-2020
Saturday    9:00 AM    7:00 PM    Normal 23-05-2020
Sunday        9:00 AM    7:00 PM    Normal 24-05-2020
Hello, I am very new to writing Apex triggers and I am practicing. I wrote the following apex trigger:

Basically, what I'm trying to do is the following:

Write a trigger that creates two identical Contacts whenever an Account is created. Make sure both Contacts are associated with the Account. Use any values for the fields on the Contacts - just make sure to use variables when populating the fields of each Contact to make sure they are identical.

rigger CreateIdenticalContacts on Account (after insert) {
    for(Account acc: Trigger.new) {
        Contact con                 =  new Contact();
        con.FirstName          =  'Aki';  
        con.FirstName          = 'Akisey';
        con.LastName           = 'Johnson';
        con.LastName          = 'Johnson';
        con.AccountId           = acc.Id;
        insert acc;

Here's my test class:
public class IdenticalContactsTest {

    @isTest static void createAccount()  {
        Account acc  = new Account();
        acc.Name                        = 'Test123';
      insert acc;

Here's the error that I' receiving:

21:41:32:112 FATAL_ERROR System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateIdenticalContacts: execution of AfterInsert

When I run test, I receive 100% code coverage. I even deleted other triggers in my sandbox org to see if the error would go away but it didn't. Any assistance would be greatly appreciated.

Hi I am new in Apex. Please help me resolve this problem.

I have a requirement to create a child record (on Billing Line object) if parent records (on Billing object) exist I need to attach the child record to the parent but if Parent record doesn't exist I need to create a parent and a child records. 

This trigger is supposed to fire when I check a checkbox on a TEST object. 

For some reason, my code can't find parent records and can't create one.   

public class testBillingLineCreate {
    public static void createBillingLine (list<TEST__c> TestList, map<id, TEST__c> oldMap)
     list<AcctSeed__Billing_Line__c> billingLineList=new List<AcctSeed__Billing_Line__c>();      
     list<AcctSeed__Billing__c> billingList= new list<AcctSeed__Billing__c>();
           for(TEST__c objtest:TestList)
        if(objtest.Billed__c==true && oldMap.get(objtest.Id).Billed__c==false)
            for(AcctSeed__Billing__c billings:[select id, name, AcctSeed__Customer__r.id, advAcctSeed__Matter__r.id from AcctSeed__Billing__c where AcctSeed__Status__c='Approved']){
                if(billings.AcctSeed__Customer__r.id==objtest.Account__r.id && billings.advAcctSeed__Matter__r.id==objtest.Matter__r.id){
            AcctSeed__Billing_Line__c bill=new AcctSeed__Billing_Line__c();
         else {
              AcctSeed__Billing__c billings2=new AcctSeed__Billing__c();
              billings2.AcctSeed__Customer__c= objtest.Account__c;
               AcctSeed__Billing_Line__c bill1=new AcctSeed__Billing_Line__c();
        insert billingList;
        insert billingLineList;
Hi Everyone,
How to write
 public static String authMethod(){
            Pardot_Credential_Setting__c objSetting = customSetting();
            if(objSetting != null){
                String email = objSetting.Pardot_Email__c;
                String password = objSetting.Pardot_Password__c;
                String userKey = objSetting.User_Api_Key__c;

                HttpRequest req = new HttpRequest();
                req.setEndpoint( objSetting.Pardot_BaseUrl__c+'/api/login/version/4' );
                req.setMethod( 'POST' );
                req.setBody( 'email=' + email + '&password=' + password + '&user_key=' + userKey );

                HttpResponse res = new Http().send( req );

                System.debug('>>>>>>>>res'+ res );
                System.debug('>>>>>>>>>res.getStatus()'+ res.getStatus() );
                System.debug('>>>>>>res.getBody()'+ res.getBody() );

                String response = res.getBody();
                Integer startIdx;
                Integer endIdx;
                String apiKey;
                    startIdx = response.indexOf( '<api_key>' ) + 9;
                    endIdx = response.indexOf( '</api_key>' );
                    apiKey = response.substring( startIdx, endIdx );
                    System.debug( '>>>>>>>apiKey'+ apiKey );
                    return apiKey;
            return null;
Hello guys, 
pretty simple, but i can not figure out, where the error comes from.  
public class UpdateBillingAdress {
    public static void retrieveAdress (Opportunity opp){
        Account billAcc = [
        FROM Account
        WHERE Id =: opp.umsatz_durch_Account__c

        Account shipAcc = [
            FROM Account
            WHERE Id =: opp.AccountId

        Boolean condition = (
            !String.isBlank(billAcc.ShippingStreet) &&
            !String.isBlank(billAcc.ShippingPostalCode) &&
            !String.isBlank(billAcc.ShippingCity) &&

            shipAcc.BillingStreet = billAcc.ShippingStreet;
            shipAcc.BillingPostalCode = billAcc.ShippingPostalCode;
            shipAcc.BillingCity = billAcc.ShippingCity;
            shipAcc.BillingCountry = billAcc.ShippingCountry;
            shipAcc.alternative_Rechnungsanschrift__c = true;
            update shipAcc;
public class TestUpdateBillingAdress {
    @isTest static void testUpdate(){
        Account billAcc =  DataFactory.createAccount();
        Account shipAcc =  DataFactory.createAccount();
        insert billAcc;
        insert shipAcc;
        Opportunity opp = DataFactory.createOpportunity('40 - Converted/Demo agreed', shipAcc.Id);
        opp.umsatz_durch_Account__c = billAcc.Id;
        insert opp;

        shipAcc.BillingStreet = ' ';
        shipAcc.BillingCity = ' ';
        shipAcc.BillingPostalCode = ' ';
        shipAcc.BillingCountry = ' ';
        shipAcc.alternative_Rechnungsanschrift__c = true;
        update shipAcc;

        Boolean condition = (
            !String.isBlank(billAcc.ShippingStreet) &&
            !String.isBlank(billAcc.ShippingPostalCode) &&
            !String.isBlank(billAcc.ShippingCity) &&
        System.debug('condition' + condition);
        System.assertEquals(shipAcc.BillingStreet, billAcc.ShippingStreet); // this should be true

I would appreciate your help !

Thank you, 
I have written the below apex class to display the lead who are parter

For example if I select the partner lead which is a look up feild as xyz then on account page I shoud be able to see his details I am getting ebelow error

Apex class
public class PartnerLeadController {
   public final Account acc;
    public PartnerLeadController(ApexPages.StandardController stdController) {
        this.acc = (Account)stdController.getRecord();
    List<Lead> lead;
    public void initlead() {
        lead = [select id,OwnerId,Owner.Name,Status,LastName,Name from Lead where Partner_Name__c = : acc.id AND  LeadSource=: 'Partner' ORDER BY Name DESC];
    public List<Lead> getlead () {
        return lead;
Vf Page

<apex:page standardController="Account" extensions="PartnerLeadController" lightningStylesheets="true" sidebar="false" >
        body {
    <apex:pageBlock rendered="true">
        <apex:pageBlockTable value="{!lead}" var="l">
            <apex:column >
                <apex:outputLink value="/Lead/{!l.Id}/view" target="_top">{!l.Name}</apex:outputLink>
                <apex:facet name="header">Lead Name</apex:facet>
            <apex:column >
                <apex:outputLink value="/lead/{!l.AccountId}/view" target="_top">{!l.Account.Name}</apex:outputLink>
                <apex:facet name="header">Lead Name</apex:facet>
            <apex:column >
                <apex:outputLink value="/{!l.OwnerId}" target="_top">{!l.Owner.Name}</apex:outputLink>
                <apex:facet name="header">Owner Name</apex:facet>
            <apex:column ><apex:outputField value="{!l.Name}" />
                <apex:facet name="header">Name</apex:facet>
            <apex:column ><apex:outputField value="{!l.Status}" />
                <apex:facet name="header">Status</apex:facet>


User-added image