• sachinarorasf
  • SMARTIE
  • 858 Points
  • Member since 2018
  • Cloud Analogy


  • Chatter
    Feed
  • 30
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 211
    Replies
Hi All,

Could you please help me for below scenerio.

Opportunity object has field called "review" and it has 3 picklist values.
there are 4 different fields which needs to be considered to update the field.

1. when al the 4 fields are true then update "review" field = pass

2 When 2 or less field are true then update "review" field= reject

3. when 3 of the fields are true then update "review" field= awaiting.

Thanks in advance 
 
Hello, I have apex class like this:

public class TwilioChatterConversationClass {
public static void ContactPostChatter(Id contactRecordId, string message){  
        if (flag == true){
        flag = false;
        Contact c = [ Select id, name, related_referral__r.ownerid, related_referral__r.name, related_Referral__r.Referral_Account__r.name From Contact Where Id =: contactRecordId];

        ConnectApi.FeedItemInput feedItemInput = new ConnectApi.FeedItemInput();
        ConnectApi.MentionSegmentInput mentionSegmentInput = new ConnectApi.MentionSegmentInput();
        ConnectApi.MessageBodyInput messageBodyInput = new ConnectApi.MessageBodyInput();
        ConnectApi.TextSegmentInput textSegmentInput = new ConnectApi.TextSegmentInput();

        messageBodyInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
        
        mentionSegmentInput.id = c.related_referral__r.ownerid;
    
//hyperlink        
String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ c.id;   
ConnectApi.LinkCapabilityInput linkInput = new ConnectApi.LinkCapabilityInput();
linkInput.url = fullFileURL;
linkInput.urlName = c.name;
ConnectApi.FeedElementCapabilitiesInput feedElementCapabilitiesInput = new ConnectApi.FeedElementCapabilitiesInput();
feedElementCapabilitiesInput.link = linkInput;
feedItemInput.capabilities = feedElementCapabilitiesInput; 
//

        messageBodyInput.messageSegments.add(mentionSegmentInput);

 //  textSegmentInput.text = 'Referral, "' + c.related_referral__r.name  +  '".         Next of Kin,' + c.name +', has responded to your text: ' + message + ' To view their record <a href=https://centers.lightning.force.com/'+c.Id+'>click here.</a>' ;
   textSegmentInput.text = 'Referral, "' + c.related_referral__r.name  +  '".         Next of Kin,' + c.name +', has responded to your text: ' + message;
    messageBodyInput.messageSegments.add(textSegmentInput);

        feedItemInput.body = messageBodyInput;
        feedItemInput.feedElementType = ConnectApi.FeedElementType.FeedItem;
        feedItemInput.subjectId = c.related_referral__r.ownerid;
        
    
ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), feedItemInput);
    return;
}
}
}
}

I'm trying test code like this, but it's not covering the class (see screenshot below). Any idea why not?

@isTest
public class TwilioTriggerTest {
@isTest
    static void TwilioTest(){
        contact c = new contact();
        c.lastname = 'Test';
        c.MobilePhone = '123456789';
        c.Responded_to_first_message__c = true;
        insert c;

        TwilioChatterConversationClass.ContactPostChatter(c.id, 'hey');
}}

User-added image
 
Hi,
Here is the usecase.
On Opportunity record, I want to show a Archive button. Onclick of the Archive button a prompt must display “Do you want to Archive the record?” , Cancel and Continue button must be displayed. Onclick of Cancel button the prompt must be closed.
Onclick of the Continue button the status of the record must be updated as ‘Archived’ and the Name of the record must be appended with ‘_Archived’. How can achieve this use case?
I have tried to create a flow and called from Quick action, but in flow i am not able to update a Status field? Does Lightning component required to achieve this case?

Hi all,
I need apex class to get documentlink field called LinkedEntityId.
This is my create task when document upload.
trigger CreateTask on ContentVersion (after insert) 
{

List<Task> insertTask = new List<Task>();
Task newTask = new Task();
for(ContentVersion newCase : Trigger.new)
{
newTask.subject = 'Document Expiration';
newTask.WhatId = newCase.Id;
newTask.ActivityDate = newCase.Expiry_Date__c;
newTask.ownerId = newCase.OwnerId;
newTask.status = 'Not started';
newTask.Priority = 'Normal';
insertTask.add(newTask);
    if(insertTask.isEmpty())
    {
        try{
            
        }catch(DmlException de)
        {
            System.debug(de);
        }
    }

}

I need to assign LinkedEntityId this id to createTask . Trigger -> WhoId.

Is anyone help?
Thanks in advance.
    

Hello, 
I need to pass the OpportunityContactRole (contact id) to a new record's field, which is a contact one. I created a map for the OpportunityContactRole and i am trying to pass that id, when i debug at the MAP i get the values but when i pass the contact id to the field i get the error of attempitng to de-reference a null object. Above is a snippet of my code:
 
map<Id, OpportunityContactRole> oppRoleMap = new map<Id, OpportunityContactRole>([select id, OpportunityId, ContactId, isPrimary from OpportunityContactRole where OpportunityId IN: oppId AND isPrimary = true limit 1]);
            	system.debug('The ROLE MAP IS' + oppRoleMap);//i get the values
                system.debug('RoleMap Values ' +oppRoleMap.values());//i get also the values
                //csconta__Contract__c contr = [select id, csconta__Account__r.id from csconta__Contract__c where csconta__Account__r.id =: opp1.accountId];
                
                for(opportunity opp: oppList){
                
                if(oppMap.containsKey(opp.id)){
                    system.debug('inside first if ' + oppMap.containsKey(opp.id));
                    
                if(opp.StageName == 'Closed Won'){
                    system.debug('IS CLOSED WON? ' +opp.StageName);
                    list<csconta__Contract__c> contrList = [select id, csconta__Account__r.id from csconta__Contract__c where csconta__Account__r.id =: opp.accountId];
                    
                    if(contrList.isEmpty()){
                   csconta__Contract__c contract = new csconta__Contract__c();
                  // contract.csconta__Contract_Name__c = 'Hello' +' Contract';
                   contract.csconta__Contract_Name__c = oppMap.get(opp.id).account.name + ' Contract';
                   contract.csconta__Account__c = opp.AccountId;
                   contract.csconta__Valid_From__c = system.today();
                   contract.csconta__Status__c = 'Open';
                   contract.csconta__Contact__c = oppRoleMap.get(opp.id).ContactId;// seems like its null
                        system.debug('The contact is '+ contract.csconta__Contact__c);
                   createcontrList.add(contract); 
                    }

What can i do to pass the contact id?
Hi Gurus,
How do i  Import Apex Classes Dev Sandbox into Visual Studio Code After successfully doing  SFDX: Authorise Org for my dev org which is a scratch org sandbox, basically I would like to execute my apex unit tests from Visual studio code..but the problem is I see only LWC project got created with project.json file  ..Here is my VSCode

User-added image

Regards,
Fiona
Milestone and Opportunity Object is there , On Opportunity you have custom field called total Amount, if opportunity is inserted with 10000 as total amount, automatically 10 milesstone should be created.
if the amount is 15000, 15 milesstone should be created and so on.
Hello, we have some simple apex code that creates a task record, and the whoid of the task is a Lead. 

My question is: Just as when a regular activity is logged, it automatically posts to chatter with a summary of the activity, I need to do the same here. Specifically, I need it to post to the chatter on the Lead record page. Can this be done?
I need to dynamically fetch the picklist values 
I have a requirement in which when the Billing State is Punjab then a custom checkbox(Exists__c should be true) on Account Object. Billing State is a picklist.
I have used Trigger to update that.
trigger ASCExists on Account (after update) {
    if(trigger.isAfter && trigger.isUpdate){
        for(Account acc:trigger.new){
            if(acc.BillingCountry == 'India' && acc.BillingState == 'Punjab' )
            {
                acc.Exists__c = true ;
                update acc;
            }
        }
    }
}
But I am getting this error as:
Error:Apex trigger ASCExists caused an unexpected exception, contact your administrator: ASCExists: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.ASCExists: line 6, column 1

How to fix this. Can somebody help in this.
Thank you 
This is the code of auto lead conversion and autoLeadConversion is the function.I had written master class so i need specific function to be tested
public class AAAExisting{ 
    public List<wrapLead> wrapLeadList {get; set;}
    public List<Lead> accs {get; set;}
    
    public void ConvertedLeadList(){
       accs = [SELECT Id, Name, ConvertedAccountId, ConvertedContactId, ConvertedOpportunityId, Status FROM Lead WHERE IsConverted=true];
   // System.debug(accs);
    }
    
    
    
    public AAAExisting(){
        if(wrapLeadList == null) {
            wrapLeadList = new List<wrapLead>();
            for(Lead a: [select Id, Name, Company, Email, Phone, Status FROM Lead WHERE IsConverted=false]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapLeadList .add(new wrapLead(a));
               // System.debug(wrapLeadList);
            }
        }
    }
       
  
    
       Public void autoLeadConversion(List<Lead> autoLeadConversions) {
       //  List<Lead> autoLeadConversions= new List <Lead>();
           for(Lead lead: autoLeadConversions){
              if (lead.isConverted == false) { //to prevent recursion
       Database.LeadConvert lc = new Database.LeadConvert();
       lc.setLeadId(lead.Id); 
       String oppName = lead.LastName;
       lc.setOpportunityName(oppName);
       LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
       lc.setConvertedStatus(convertStatus.MasterLabel);
       Database.LeadConvertResult lcr = Database.convertLead(lc);
       System.assert(lcr.isSuccess());            
           }
        } 
    }
 
   
    
    public void processSelected() {
        for(wrapLead wrapAccountObj : wrapLeadList ) {
        if(wrapAccountObj.selected == true) {
            Database.LeadConvert lc = new Database.LeadConvert();
           lc.setLeadId(wrapAccountObj.acc.Id);
           lc.setopportunityname(wrapAccountObj.acc.Company);
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            lc.setConvertedStatus(convertStatus.MasterLabel);
            Database.LeadConvertResult lcr = Database.convertLead(lc);
            }
            }
             }
 
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Account and a Boolean value
    public class wrapLead{
        public Lead acc {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapLead(Lead a) {
            acc = a;
            selected = false;
            System.debug('convertStatus'+ acc);
        }

    }
    
}



 
Hi,

I'm trying to insert a negative number but it does not allow me to enter a minus. 

<lightning:input min="-10.0" type="number" formatter="decimal" step = ".01" value="{!v.price}" onchange="{!c.calc}"/>
                                                                
Hello everyone,
My component:
apex:component layout="block" access="global" language="{!lan}" id="ac" >
apex:attribute name="selA" type="String" default="" description="" />
apex:attribute name="SOList" type="map" default="" description="" />

apex:selectList value="{!selA}" size="1 id="aslLinOrgMan" >
apex:selectOption itemValue="" itemLabel="Select" />
/apex:selectList>
What I would like to do is dynamically building the list <apex:selectOption> with the itemValue/itemLabel passed in the SOList map attribute, or through another approach if this is not a good one.
Is there a way to achieve this? If so, how?
Thanks in advance for your support,
All the best,
Jerome
Hi All,

I was referring the salesforce documentation for lightning:input type="email" .There it is mentioned When multiple email is used, the email field expects a single email address or a comma-separated list of email addresses. Example, my@domain.com,your@domain.com with or without a space after the comma.Is it possible to use type="email" when there is a need to enter multiple email id.I have tried to enter multiple emails with comma separation but it is giving me error as "You have entered an invalid format.".
Hi all,

I need something like a clickable image. when I click the image in a page related record should be created.

Thanks in advance.
How to get All Objects and Their Field? Please help me thank before<.^.>
Hello, I am working on updating Salesforce records from an outside platform, and I need my:
1. SF Consumer Key
2. SF Consumer Secret
3. SF Token

How can I find what these are? 
Hi ,

I tried to create my first lightning application but i get the folowing error.

User-added image

Below is my code

Application
<aura:application extends="force:slds" >
    <c:TeacherAppCompo/>
</aura:application>

Component
<aura:component controller='TeacherCreateRecord' >

    <aura:attribute name="client" type="Teacher__c" default="{'sObjectType':'Teacher__c','Name' : '' }" />
    <ui:inputtext label="Enter Teacher Name"   value="{!v.client.Name}" />
    <ui:button label="Submit" press="{!c.createClient}"/>
</aura:component>

Client side contoller
({
    createClient : function(component, event) {
        
        
       //for logs
        console.log("In Client Controller");

        //getting the record info from component to js
        var varClient=component.get("v.client");
       
        //validation to  check of field is empty or not
        if($A.util.isEmpty(varClient.Name) || $A.util.isUndefined(varClient.Name) )
        {
           alert('First name is required');
            //return the value and function will stop
            return;
        }
         
         helper.createRecord(varClient);
    }
})

Helper
({
    createRecord : function() {
         
       
       console.log("In helper");
        
        //calling apex function
        alert('Before action');
        var action = component.get("c.createTeacherRecord");
         
        alert('Before set params function');
        //set the parameters
        action.setParams({
            client : varClient
        });
        
        alert('Before callback function');
        //set callback function
        action.setCallback(this,function(a){
            
            var response=a.getState();
            if(response == "SUCCESS")
            {
                //Reset form and this is optional
                var newrecord= {'sObjectType' : 'Teacher__c','Name':''};
                component.set("v.client",newrecord);
                alert('Record is Created');
            }else if(response == "ERROR")
            {
                alert('Record is not Created');
            }
        });
        //To enqueue all actions and let all happen one by one 
        $A.enqueueAction(action);
    }
    
})

ApexClass
public with sharing class TeacherCreateRecord {
    
    
    @AuraEnabled
    public static void createTeacherRecord(Teacher__c  client)
    {
        try{
            System.debug('Teacher Create Record class'+ client) ;
            if(client != null)
            {
                insert client;
            }
        }
    
       catch(Exception e) 
       {
            System.debug('Inside Apex class') ;   
       }
    }
 }

The object i have used is Teacher__c and i am trying to fetch the name which is a standard field .
Hi I am preparing for Saleforce Developer certification (PD-01) , I came acroos the below question.

A developer wants multiple test classes to use the same set of test data?

As per my kowledge , answer should be 'create set up method for each test class'

But in dump paper, it says,  "use seealldata==true annotaton in the test class"

i am not getting how it works, please explain.

Also please share dumps if u have
Need to create a report to provide the average number of Log-a-Call task records per day by Assigned user.
"statusList":[
"BEINGPICKED"
],
"fulfilmentType":"HWD",
"productLineStatus":"{\"BEINGPICKED\":1}",
"productLineStatuses":{
"BEINGPICKED":1
}
},
{
"id":"445734",
"productName":"Kids Bike Build HWD",
"productType":"standard",
"brand":null,
"price":{
"sales":{
"currency":"GBP",
"symbol":"£",
"value":15,
"formatted":"£15.00",
"decimalPrice":"15.00"
}
},
"status":"In progress",
"statusList":[

],
"fulfilmentType":"HWD",
"productLineStatus":null,
"productLineStatuses":{

}
}
],
"totalQuantity":1
}
}
}
Hi Everyone, 
I have this Apex Trigger in Sandbox that check if there is an attachment when Grant is Awarded, I need a test class to Deploy it in the production environment,any help..

trigger AttachmentValidation on Opportunity (before update) {
    
    Set<Id> OpptyIdSet = new Set<Id>();
    
    for(Opportunity oppty : Trigger.new){
        //Validation of the fields
        if(oppty.StageName == 'Grant Awarded'){
              OpptyIdSet.add(oppty.id);          
        }
    }
    
    for(Opportunity oppty : [SELECT id,name,(SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLinks) FROM Opportunity WHERE id in:OpptyIdSet]){
        
        if(oppty.ContentDocumentLinks.isEmpty()){
            Trigger.newMap.get(oppty.Id).addError('A Grant Agreement attachment is required. If New Opportunity Stage is Grant Awarded/Completed/Certain, to attach, change the stage to anything other than Grant Awarded/Completed/Renewal - Certain and then save it. Afterwards, edit the opp and change the stage as desired and add the attachment.');
        }
    }
}


Thank you.
 
  • January 17, 2021
  • Like
  • 0
Hello,

I'm relatively new to SOQL and Conga Query builder and am attempting to query related data of the same object, using a lookup of the current object. Here is how the objects are related:

From the current Custom object, I have a lookup relationship to accounts--the field is Primary Account. I'd like to query all other related objects of the same type as the current object. My statement looks like this so far, however, it is failing.

SELECT Custom_Field1__c, Name FROM Custom__c WHERE Primary_Account__r.Id = Primary_Account__c.Id

Primary_Account__r.Id is the ID of the Master "Primary Account" on the Custom record, but the query doesn't seem to be pulling the Id to match from the current custom object so that the query can pull all related Custom_Field1 and Name fields from the other custom objects related to the Primary Account. I hope this all makes sense.

Thank you in advance.
Hi All,

I have to compare two string vales in apex whether they are same vales or not. Could anyone please help me.  

String str1 = Pay TV;AVOD;Basic TV;
String str2 = Basic TV;Pay TV;AVOD;

Thanks,
Anil Kumar
Hi  Team,

I need to write a trigger to update the address on the contact object if a user select a checkbox on account filed address then   copy  the same values into conatct object 


trigger accountcontact on account(after insert,after update)
{
List<contact> contactupdate list = new List<contact>();
{
for (account a : trigger.new){
contactupdate.add(a);
}
}
List<account> Updatedcontact = new List<account>([select id,name,accountid,(select id,name from contact where accountid in :accountid]);
for(account acc : trigger.new){
if(acc.address =='true')
contact.address = acc.address;
contact.city = accc.city;
contact.pincode= acc.pincode;
contact.district = acc.district;
updatedcontact.add(acc);
}
insert updatedcontact;
}
Hi i have a requirement that if i upload any attachment to account it will automatically be uploaded to my google drive. Can anyone help me achieving this.
I had connected my google drive to salesforce org via Auth. provider and Named Credential.
dont know how to do next help.
Thanks in advance.
Hi Experts,

I have requirment i need to update account field  product_value__c with the  product  field Family__c( all the product values has to add to product value field),when ever the opprotunity stage is closed. to achieve this i have written batch class on opportunity but its not working as expected. Its taking lot of time to update records.
 
global class batchAccountUpdate implements Database.Batchable<sObject> {
    
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        
        String query = 'SELECT id,Accountid,stagename,IsRenewal__c FROM Opportunity ';
        
        return Database.getQueryLocator(query);
        
    }
    

    
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
        
        set<id>accountids= new set<id>();
        set<id>opptyids= new set<id>();
        set<Id> addOn = new set<Id>();
        list<account>accountupdate= new list<account>();
        map<id,account> accmap = new map<id,account>();
        Map<id,OpportunityLineItem > accountid=new map<id,OpportunityLineItem >();  
         Map<id,Product2 > products=new map<id,Product2 >();
        for(Opportunity o : scope)
        {
            if(o.stagename=='closed')
            {
              
                opptyids.add(o.id);
            }  
            
        }
        
        for(Product2 oli : [SELECT id,Business__c,Family__c FROM Product2 where Business__c = 'sales']) 
        {
            
            addOn.add(oli.Id);
            products.put(oli.id,oli);
             
        }
        
        Map<Id,OpportunityLineItem > oppsToget = new Map<Id,OpportunityLineItem >([SELECT id,Product_Lookup__r.Business__c,Product_Lookup__r.Family__c,OpportunityId,Product_Lookup__c,opportunity.accountid,opportunity.StageName FROM OpportunityLineItem where Product_Lookup__c IN:products.keyset() and opportunityid in:opptyids]);
       
        for (OpportunityLineItem oli3: oppsToget.values())
        {
            accountid.put(oli3.opportunity.accountid,oli3);
           
            
        } 
        
        Map<Id,Account> mapAccount = new Map<Id,Account> ([select id,product_value__c from account where id in :accountid.keyset()]);    
        for(account a:mapAccount.values())
        {
            if(accountid.containskey(a.id))
            {
                system.debug('@@accountid.containskey(a.id)'+accountid.containskey(a.id)); 
                for(OpportunityLineItem line: accountid.values())
                {
                    if(line.Product_Lookup__c!= null)
                    {
                     
                           String prodstring='';
                           set<string>unique=new set<String>();  
                           for(String s:line.Product_Lookup__r.Family__c.split(','))
                           {
                           unique.add(s);
                            system.debug('@@unique'+unique);  
                           }
                            if(unique.size()!=0){
                        for(String st : unique ){  
                            prodstring = prodstring +','+ st;
                              system.debug('@@prodstring '+prodstring );
                            }
                         }
                        a.product_value__c = prodstring;
                      
                        accountupdate.add(a);
                      
                        
                       
                    }  
                }
            }
        }
        accmap.putall(accountupdate);

        if(!accmap.isEmpty()){
            Database.SaveResult[] IsShareResult = Database.update(accmap.values(), false);
            
        }
    }   
    
 
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}

 
1=list<String> firstcolourlist=new list<String>{'red','blue','yellow','orange','blue','red'};
    2=  list<String>secondcolourlist=new list<String>{'blue','black','yellow','green','blue'};

if we compare list1 - list2 or list2 - list1  we have to print common values in both lists along with their count
Hi All,

Could you please help me for below scenerio.

Opportunity object has field called "review" and it has 3 picklist values.
there are 4 different fields which needs to be considered to update the field.

1. when al the 4 fields are true then update "review" field = pass

2 When 2 or less field are true then update "review" field= reject

3. when 3 of the fields are true then update "review" field= awaiting.

Thanks in advance 
 
Hello, I have apex class like this:

public class TwilioChatterConversationClass {
public static void ContactPostChatter(Id contactRecordId, string message){  
        if (flag == true){
        flag = false;
        Contact c = [ Select id, name, related_referral__r.ownerid, related_referral__r.name, related_Referral__r.Referral_Account__r.name From Contact Where Id =: contactRecordId];

        ConnectApi.FeedItemInput feedItemInput = new ConnectApi.FeedItemInput();
        ConnectApi.MentionSegmentInput mentionSegmentInput = new ConnectApi.MentionSegmentInput();
        ConnectApi.MessageBodyInput messageBodyInput = new ConnectApi.MessageBodyInput();
        ConnectApi.TextSegmentInput textSegmentInput = new ConnectApi.TextSegmentInput();

        messageBodyInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
        
        mentionSegmentInput.id = c.related_referral__r.ownerid;
    
//hyperlink        
String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ c.id;   
ConnectApi.LinkCapabilityInput linkInput = new ConnectApi.LinkCapabilityInput();
linkInput.url = fullFileURL;
linkInput.urlName = c.name;
ConnectApi.FeedElementCapabilitiesInput feedElementCapabilitiesInput = new ConnectApi.FeedElementCapabilitiesInput();
feedElementCapabilitiesInput.link = linkInput;
feedItemInput.capabilities = feedElementCapabilitiesInput; 
//

        messageBodyInput.messageSegments.add(mentionSegmentInput);

 //  textSegmentInput.text = 'Referral, "' + c.related_referral__r.name  +  '".         Next of Kin,' + c.name +', has responded to your text: ' + message + ' To view their record <a href=https://centers.lightning.force.com/'+c.Id+'>click here.</a>' ;
   textSegmentInput.text = 'Referral, "' + c.related_referral__r.name  +  '".         Next of Kin,' + c.name +', has responded to your text: ' + message;
    messageBodyInput.messageSegments.add(textSegmentInput);

        feedItemInput.body = messageBodyInput;
        feedItemInput.feedElementType = ConnectApi.FeedElementType.FeedItem;
        feedItemInput.subjectId = c.related_referral__r.ownerid;
        
    
ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), feedItemInput);
    return;
}
}
}
}

I'm trying test code like this, but it's not covering the class (see screenshot below). Any idea why not?

@isTest
public class TwilioTriggerTest {
@isTest
    static void TwilioTest(){
        contact c = new contact();
        c.lastname = 'Test';
        c.MobilePhone = '123456789';
        c.Responded_to_first_message__c = true;
        insert c;

        TwilioChatterConversationClass.ContactPostChatter(c.id, 'hey');
}}

User-added image
 
I am new to coding and have a question.

Reuirement is: I have custom field (checkbox) named " inactive". another standard field on same object named "Report to". "Report To" field have lookup relationship to contact itself. 

I want to remove any value in "report to" or i would say i want to make "report to" field null if "inacitve" field is checked. 

Can you help me write trigger for it. 
Hi,
Here is the usecase.
On Opportunity record, I want to show a Archive button. Onclick of the Archive button a prompt must display “Do you want to Archive the record?” , Cancel and Continue button must be displayed. Onclick of Cancel button the prompt must be closed.
Onclick of the Continue button the status of the record must be updated as ‘Archived’ and the Name of the record must be appended with ‘_Archived’. How can achieve this use case?
I have tried to create a flow and called from Quick action, but in flow i am not able to update a Status field? Does Lightning component required to achieve this case?
Hi,

I am trying to write a before delete trigger on a custom object to capture information before its deleted and then save it to another custom object and getting errors.
I am not a developer but having ago (badly so far).  Here is what I have and the errors: -

Trigger so far for deletion

trigger deleteproject on Project__c (before delete)
 {
        List<Deleted_Records__c> lstToInsrt = new List<Deleted_Records__c>(); 

        for(Deleted_Records__c deletedProj : trigger.old)
        {         
       
            Deleted_Records__c pd = new Deleted_Records__c();
              pd.Object_Name__c = 'Project';
              pd.Object_Record_ID__c = Project__c.Id;
              pd.Date_Deleted__c = DateTime.NOW();
              pd.Deleted_Record_Owner__c = Project__c.OwnerId.Name;
              pd.Who_Deleted__c = getFirstName() + getLastName();
              pd.Project_Name__c = Proect__c.Name;
              pd.Project_Code__c = Project__c.Project_Code__c;
              pd.Region__c = Project__c.Region__c;
              pd.Project_Active_or_Dormant__c = Project__c.Project_Active_or_Dormant__c;
              pd.ERP_ID__c = Project__c.ERP_ID__c;
              pd.Object_Contact__c = Project__c.Project_Contact1__c;
        

            lstToInsrt.add(pd);
        }
        if(lstToInsrt.size()>0){
            insert lstToInsrt;
        }
   
}

I am getting the error Illegal assignment from Schema.SObjectField to String at line 10 column 15.

The field Object_Record_Id__c is a text field.
I am sure I will get a similar error for the fields Who_Deleted__c and also Deleted_Record_Owner__c
  • December 14, 2020
  • Like
  • 0

Hi all, 
I have a custom object "Custom1" on which we added an Approval process. The process is easy when the object is approved by the approver then I have a Final Approval Actions that is set to update a field in "Custom1" Called is_approved ( True/False - Checkbox)

Then using a Flow builder I set that if the field is is_approved: True then it should trigger the flow that will update a field in many records linked to "Custom1"

For some reason, the Flow Builder is not triggered when it happens after the approval process. However, if I edit the field is_approved to TRUE manually then the flow is triggered 

Could you please help me to trigger it after the approval process?

 

FYI: User-added image

 

1=list<String> firstcolourlist=new list<String>{'red','blue','yellow','orange','blue','red'};
    2=  list<String>secondcolourlist=new list<String>{'blue','black','yellow','green','blue'};

print the common values
            
Hey developers,

I'm little confused trying to access a field in this object, could you help me? 

I have the following sentence in the code:

Map<String, Object> tester = exampleFunction();

When I get the response using "system.debug(tester)" I get the following structure:

{cartId=222222XX, 
messages=(cc_bean_Message:[classToAppend=couponMessagingSection-Error, 
labelId=CouponAddMsg_MaxUseExceeded, 
messageId=null])
}

What I am trying to access is the value of "labelId", how can I do this? 
Hello,

I'm relatively new to SOQL and Conga Query builder and am attempting to query related data of the same object, using a lookup of the current object. Here is how the objects are related:

From the current Custom object, I have a lookup relationship to accounts--the field is Primary Account. I'd like to query all other related objects of the same type as the current object. My statement looks like this so far, however, it is failing.

SELECT Custom_Field1__c, Name FROM Custom__c WHERE Primary_Account__r.Id = Primary_Account__c.Id

Primary_Account__r.Id is the ID of the Master "Primary Account" on the Custom record, but the query doesn't seem to be pulling the Id to match from the current custom object so that the query can pull all related Custom_Field1 and Name fields from the other custom objects related to the Primary Account. I hope this all makes sense.

Thank you in advance.