• Puspendra Singh
  • NEWBIE
  • 35 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies
Hello Experts,

I have a situation where i need to insert a record in custom metadata object using apex trigger. I have written the trigger and it is working fine. 
Now since i need to move the code into production, i have to write a test class for this. Can someone please suggest how should i write this test class.
Here is my class that is being called from trigger

Public class UpdateMetadataUtil implements Metadata.DeployCallback {
    
    public void handleResult(Metadata.DeployResult result, Metadata.DeployCallbackContext context) {
        if (result.status == Metadata.DeployStatus.Succeeded) {
            System.debug(' success : '+ result);
        } else {
            System.debug(' fail : '+ result);
        }
    }
    
    //Method to update Integration_Credential.PO_Header_NBS Custom Metadata record.
    @future
    public static void UpdateMetadata(String headerMap){
        Metadata.CustomMetadata customMetadata =  new Metadata.CustomMetadata();
        customMetadata.fullName = 'Integration_Credential.PO_Header_NBS';
        customMetadata.label = 'PO Header NBS';
        Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
        customField.field = 'HeaderMap__c';
        customField.value = headerMap; 
        customMetadata.values.add(customField); 
        Metadata.DeployContainer mdContainer = new Metadata.DeployContainer();
        mdContainer.addMetadata(customMetadata);
        UpdateMetadataUtil callback = new UpdateMetadataUtil();
        Id jobId = Metadata.Operations.enqueueDeployment(mdContainer, callback);
    }
Hi Experts,

I have a custom metadata where i have a record, which i want to update using an external application. The external application has full access to on salesforce using the connected app. I understand using standard REST API, we can get the  record, but can not perform DML operation on custom metadata.
Can anyone tell me if there is a way to update custom metadata records via external application? 
 
Hi,
I have a requirement, where in a financial system we do arround 1 million transactions per day. Now my requirement is to push these records in Salesforce everyday in a nightly batch. Can someone help me if this bulk load is possible using a batch job scheduled in SF? Would I hit any governer limit?
Hi,
I have created a screen flow in new flow builder to get the status against an order number from order object. The flow is active and running fine.
I need to use it on Einstein Chat bot in my community.

Now when i am trying to use flow in bot builder, i am not finding the flow under action. It says "No Invocable Actions found".
Can someone tell me what is that i need to do additionally  so i can see the flow in bot builder?User-added image
Hi I am pulling data from an external source via a webservice callout. My Contacts are duplicate but i am filtering out duplicate contacts using email before the DML operation, but i am still getting below error

"00:01:06:426 EXCEPTION_THROWN [331]|System.DmlException: Insert failed. First exception on row 2755; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.: []"

Can someone please help how do i get rid of this issue?
Hi I am creating a integration package that include an apex class which makes a call out to an external webservice and pull data and insert it into salesforce. This is working fine in my developer org. Now when i created a managed package and installed it in client sandbox, the process of insertion failed as client has one of the custom lookup field on Case object that looksup to contact. This field is made required. This is causing my process fail. Can someone suggest how do i bypass it in?
Hello, I am new to APEX, Can someone tell me if this is possible to have duplicate Key in a MAP. I am adding element from a list to a map and when i print my map, i see duplicate value of the key. Here is how my map and its data items are defined.

public class ZTECase
    {
        public string OracleCaseNumber{get;set;}
    }
public class ZTEContact
    {
        public string FirstName{get;set;}
        public string LastName{get;set;}
        public string EmailAddress{get;set;}  
}

  map<ZTECase,ZTEContact> mapZTEData=new map<ZTECase,ZTEContact>
                      ZTECase objZTECase=new ZTECase();    
                      ZTEContact objZTEContact=new ZTEContact();    

In this map, we are adding  OracleCaseNumber and Contact info from Oracle Service Cloud. When i am printing this map post my addition, i see duplicate OracleCaseNumber which is my Key in the map ZTECase. Please suggest
 
I am using <lightning:inputField /> for creating input field in component,I want make input is required or mandatory in lightning component.

Please provide sample code or solution around above senario.
Hi I am pulling data from an external source via a webservice callout. My Contacts are duplicate but i am filtering out duplicate contacts using email before the DML operation, but i am still getting below error

"00:01:06:426 EXCEPTION_THROWN [331]|System.DmlException: Insert failed. First exception on row 2755; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.: []"

Can someone please help how do i get rid of this issue?
Hi I am creating a integration package that include an apex class which makes a call out to an external webservice and pull data and insert it into salesforce. This is working fine in my developer org. Now when i created a managed package and installed it in client sandbox, the process of insertion failed as client has one of the custom lookup field on Case object that looksup to contact. This field is made required. This is causing my process fail. Can someone suggest how do i bypass it in?
Hi All,

I have build a basic integration between Amazon Connect and Salesforce using Amazon Connect CTI Adapter and I can answer calls in Salesforce Classic, but can these inbound calls be routed using Omni-Channel's logic? As per help documentation work tasks can be routed, but are calls considered as work task?

If possible I would like to have Amazon Connect just do the call part, forward all the calls to Salesforce and then have Omni-Channel do the routing to correct/available agent.

Any ideas or tips how to approach is appreciated.
Hello, I am new to APEX, Can someone tell me if this is possible to have duplicate Key in a MAP. I am adding element from a list to a map and when i print my map, i see duplicate value of the key. Here is how my map and its data items are defined.

public class ZTECase
    {
        public string OracleCaseNumber{get;set;}
    }
public class ZTEContact
    {
        public string FirstName{get;set;}
        public string LastName{get;set;}
        public string EmailAddress{get;set;}  
}

  map<ZTECase,ZTEContact> mapZTEData=new map<ZTECase,ZTEContact>
                      ZTECase objZTECase=new ZTECase();    
                      ZTEContact objZTEContact=new ZTEContact();    

In this map, we are adding  OracleCaseNumber and Contact info from Oracle Service Cloud. When i am printing this map post my addition, i see duplicate OracleCaseNumber which is my Key in the map ZTECase. Please suggest
 
HI All,
         I am Begginer of salesforce,I have  Create one Master field to One object(xxx) to another Object(yyyy).Now I dont want master Detail filed. So,How To Delete that master Field.??

Advance Thanks