• Raj Vakati
  • ALL STAR
  • 21506 Points
  • Member since 2016

  • Chatter
    Feed
  • 707
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 6312
    Replies
I need help changing my APEX trigger Im getting the following error message  

MassLeadConverterControllerTest
massLeadTest
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Health_Score_Calculation_New: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.Health_Score_Calculation_New: line 12, column 1: [] 
Stack Trace: Class.MassLeadConverterControllerTest.massLeadTest: line 11, column 1


Below is the Trigger 

trigger Health_Score_Calculation_New on Account (before insert) {
  if(Trigger.isBefore)
  {
    if (Trigger.isInsert || Trigger.isUpdate)
     {
       for(Account cob : trigger.new)

         {
            cob.Score__c = (cob.Implementation__c * 0.15) + 
                           (cob.Migration_In_Progress__c * 0.20) + 
                           (cob.Days_With_No_Activity__c * 0.15) + 
                           (cob.Contact_New_Rollup__c * 0.15) + 
                           (cob.Contact_Left_Rollup__c * 0.15) + 
                           (cob.Issues__c * 0.20) ;
           }
       }
    }
}
Hi all,

I have customized our Cases layout to include custom auto numbered cases because I cannot edit the standard case number field. This has led to a multitude of problems. When viewing cases in the All Open, My Cases, and Recently Viewed options, I can customize the view to show the custom auto numbered field but it doesn't provide a hyperlink to access the case. 
User-added image
When I go to the Recently Viewed Cases menu, I cannot edit and does not show the custom case number. However, it does provide a link to click thru to the case. Problem being, we don't want to use the standard case numbers.
User-added image

Salesforce support recommended using Visualforce to create a hyperlinked case number. I have zero experience with Apex or Visualforce so I'm not sure where to go from here. I do feel like there is a much simpler solution to this issue.

Any help would be much appreciated!

Thanks
I am having a super hard time in writing a test class. The extension lets a user select multiple records from child (Contingency__c) and add to the related list of parent (Billing_Change_form__c) where the account is the same. It contains a wrapper class. I have no idea how to get any coverage.
This is the test class that I have come up with so far:

@isTest
public class bcfTest {
   public static testMethod void adBill(){
        Billing_Change_form__c testBill = new Billing_Change_Form__c();
        testBill.Name = 'Test name';
        insert testBill;
        
       Billing_Change_form__c testBill2 = new Billing_Change_Form__c();
        testBill2.Name = 'Test name2';
        insert testBill2;
       
         Contingency__c caseTest = new Contingency__c();
        caseTest.Name = 'test Case';
        caseTest.Contingency__c = 'IN BILLING';
        caseTest.VENDOR_INVOICE__r.Account_del__r.id='1234';
        insert caseTest;
        
       Contingency__c caseTest2 = new Contingency__c();
        caseTest2.Name = 'test Case2';
        caseTest2.Contingency__c = 'IN BILLING';
        caseTest2.VENDOR_INVOICE__r.Account_del__r.id='5678';
        insert caseTest2;
       
        Account accTest = new Account();
        accTest.Name = 'Test Account';
        insert accTest;
       
        Test.startTest();
       PageReference pageRef = Page.bcTest; // Add your VF page Name here
        pageRef.getParameters().put('id', String.valueOf(testBill.Id));
       Test.setCurrentPage(pageRef);
       
      
        List<wrapperCase> wrapList = new List<wrapperCase>();
        List<Contingency__c> selCase = new List<Contingency__c>();
        
       for(Contingency__c b : [Select id, name, 
                               contingency__c, VENDOR_INVOICE__r.Account_del__r.Id from Contingency__c
                               where (VENDOR_INVOICE__r.Account_del__r.Id = :accTest.Id) ]){
                                   wrapList.add(New wrapperCase(b));
                               }
       
       
       for(wrapperCase WATest: wrapList){
           WATest.check = true;
       }
       
           
        System.assertEquals(testBill.Id, caseTest.Bill_Form__c);
        System.assertEquals('Test name',testBill.Name);
        System.assertEquals('IN BILLING', caseTest.CONTINGENCY__c);
        
        test.stopTest();
    }
    public class wrapperCase{
        public contingency__c con{get;set;}
        public boolean check{get;set;}
        public wrapperCase(contingency__c c){
            con = c;
            check = false;           
        }
    }
}

My controller extension:
public with sharing class test2 {
    //Declare varialbles
    public string lookup{get;set;}
    public list<conCase> caseList{get;set;}
    public boolean allbool{get;set;}
    public string inputValue{get;set;}
    public boolean bool{get;set;}
    public set<id> caseIds{get;set;}
    Billing_Change_form__c[] accID = [Select account__c from Billing_Change_Form__c where 
                                               id = :System.currentPagereference().getParameters().get('id')];
    
    
    ApexPages.StandardController controller;
    
    //Constructor
    public test2(ApexPages.StandardController con){
        controller = con;
        caseList = new list<conCase>();
        bool = false;
        caseIds = new Set<id>();
    }


    //Event on clicking the checkbox
    public void inIt(){
        List<Contingency__c> selectedCase = new list<Contingency__c>();
        lookUp = '';
        for(conCase conObj : caseList){
            if(conObj.check != False){
                system.debug('conObj.con'+ conObj.con);
                selectedCase.add(conObj.con);
                lookUp += conObj.con.name + ', ';
                system.debug('lookup:'+ lookup);
                caseIds.add(conObj.con.id);
                bool = true;
            }
               If(conObj.check != true){
                caseIds.remove(conObj.con.id); }   
    }
    }

    //Displaying the records 
    public List<conCase> getShow(){
        caseList = new list <conCase> ();

        for(Contingency__c coObj : [Select id, name,billing_type__c, report_description__c, discovery_amount__c,
                        billing_begins_date__c, contingency__c, VENDOR_INVOICE__r.Account_del__r.Id from Contingency__c
            where (VENDOR_INVOICE__r.Account_del__r.Id = :accID[0].Account__c)  AND (Bill_form__c = null)])
                                 
        {
            caseList.add(new conCase(coObj, Bool));
        }
     
        return caseList;
    }
        
    //Event on saving the selected records
    public PageReference mySave(){
        list<Contingency__c> updateSelectedCase = new list<Contingency__c>();
        id billId = ApexPages.currentPage().getparameters().get('id');
        System.debug('Bill ID is' + billID);
        for(Contingency__c co:[select id, name, bill_form__c from Contingency__c where id = :caseIds ]){
            co.bill_form__c = billId;
            updateSelectedCase.add(co);
        }
        update updateSelectedCase;
        return null;
    }

    //Event When the cancel button is hit
    public void closePopup(){
        bool = false;
    }
    public void add(){
        bool = true;
    }
    
    //Wrapper class for the selected records
       public class conCase{
        public contingency__c con{get;set;}
        public boolean check{get;set;}
        public conCase(contingency__c c, boolean boo){
            con = c;
            check = boo;           
        }
    }
    
}

My visualforce Page:

<apex:page showHeader="False" standardController="Billing_Change_Form__c" extensions="test2">
  <script>
     function closeWindow(){      
            window.opener.location.href="/{!$CurrentPage.parameters.id}";
            window.top.close();
      }
    </script>
    
    <apex:form >
    <apex:PageBlock title="CaseFindings" id="counter">

                    <apex:pageBlockButtons >
                      <apex:commandButton value="Save" action="{!mySave}" onComplete="closeWindow();"/>   
                      <apex:commandButton value="Cancel" onclick="window.top.close();" immediate="true" action="{!closePopup}"/>  
                </apex:pageBlockButtons>

            <apex:pageBlockTable value="{!show}" var="e" title="show">
                
            <apex:column >
                <apex:inputCheckbox value="{!e.check}" />
    <apex:actionSupport event="onclick" action="{!inIt}" rerender="none"/>
                </apex:column>
                
                <apex:column value="{!e.con.Name}"/>
                <apex:column value="{!e.con.DISCOVERY_AMOUNT__c}"/>
                <apex:column value="{!e.con.BILLING_BEGINS_DATE__c}"/>
                <apex:column value="{!e.con.REPORT_DESCRIPTION__c}"/>
                <apex:column value="{!e.con.CONTINGENCY__c}"/>
            </apex:pageBlockTable>
        </apex:PageBlock>
    </apex:form>
</apex:page>


Hoping to get standard 75% coverage. If anyone can help me with it, I would really appreciate it! Thanks!
 
Data Storage Limits Exceeded
Your company currently has exceeded its data storage limits including an extra overflow buffer. Per our terms and conditions, we cannot permit additional data creation within our system until your company first reduces its current data storage. Please contact your company's salesforce.com administrator to resolve this. We apologize for any inconvenience this may cause. 

How Can i solve my Problem.....................

Thank You 
I have the map 
var lat, lng
var map = component.get('v.map'); 

map.locate({setView: true,  maxZoom: 13});  
               function onLocationFound(e) {
                      lat = e.latlng.lat
                      lng = e.latlng.lng
               }
I need specifficaly lat lng from my current position
  • January 15, 2019
  • Like
  • 0

According to the API documentation:

https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_xml_rel_fields.htm

the it should be able to make relationship between objects but when I followed the instruction, I get an error below:

[
{
"success": false,
"created": false,
"id": null,
"errors": [
{
"message": "Unexpected JsonMappingException: Cannot deserialize instance of reference from START_OBJECT value { or request may be missing a required field\n at [Source: java.util.zip.GZIPInputStream@5889e6b8; line: 4, column: 26]",
"fields": [],
"statusCode": "INVALID_FIELD",
"extendedErrorDetails": null
}
]
},
{
"success": false,
"created": false,
"id": null,
"errors": [
{
"message": "Json Deserialization failed on token 'Author_ID__c' and has left off in the middle of parsing a row. Will go to end of row to begin parsing the next row",
"fields": [
"Author_ID__c"
],
"statusCode": "INVALID_FIELD",
"extendedErrorDetails": null
}
]
}
]


request url:
https://myinstance--sandbox1.my.salesforce.com/services/async/44.0/job/batch_id/batch

request body:
[
    {
        "Name":"Test Title",
        "Contributor_lookup__c":{"Author_ID__c":"test-user-id"}
    }
]
I'm hoping anyone here can help me what I'm doing wrong.
Thank!
Hi i have a requirement where we have a custom object call managment__c  and 
where on a field stage__c is stage-2 
it will hide survey__c field from vf page how can i achieve ?
<apex:OutputField value="{!Managment__c.stage__c}" rendered="{! IsSurvey || IsIsSurveyDETAILS }"/>
 <apex:OutputField value="{!Managment__c.survey__c}" rendered="{!IsSurvey}" />

 
I need to create a map of the Opp ID and the primary contact owner id when I have the opp id.

So far, I have:
for (OpportunityContactRole OCR: [Select ContactId from OpportunityContactRole where OpportunityID in :newOpp and IsPrimary = TRUE]){
                OppAndContact.put(OCR.id, OCR.contactId);
        }

I'm kind of stuck now - is there a way I can get the map in one step? 
  • January 14, 2019
  • Like
  • 0
This is mai map component

<aura:component >
    <aura:attribute name="map" type="Object"/>
    <aura:handler event="c:AccountsLoaded" action="{!c.accountsLoaded}"/>
    <aura:handler event="c:AccountSelected" action="{!c.accountSelected}"/>
    
    <ltng:require styles="/resource/leaflet/leaflet.css"
        scripts="/resource/leaflet/leaflet.js"
        afterScriptsLoaded="{!c.jsLoaded}" />
    <div id="map">
        <c:RadiusListItem/>   - this is the list of items that i want to display in the right corner of the map
    </div>
</aura:component>
  • January 14, 2019
  • Like
  • 0
Below class updating the contact field (Account_status_BG__c)from the account field (Membership_Defined__c).
It is only covering 60 %. it is not going under if condition.
public class AccountStatusUpdate {
    
    public static void acntStatusMethod(List<Account> ac,Map<Id,Account> oldAccountMap){
        set<Id> accIds = new set<Id>();
        for(Account acc: ac){
            accIds.add(acc.Id);
        }
        
        if(accIds.size() > 0){
            List<Contact> contactList = [SELECT Id,Account_Status__c, AccountId, Account.Membership_Defined__c FROM Contact WHERE AccountId IN : accIds];
            //Create a list to update the contacts    
            List<Contact> contactToBeUpdate = new List<Contact>();
            for(Contact objCont : contactList){ 
                if(oldAccountMap!= null && String.isNotBlank(objCont.Account.Membership_Defined__c) && objCont.Account.Membership_Defined__c != oldAccountMap.get(objCont.AccountId).Membership_Defined__c){
                    Contact newContact = new Contact();
                    newContact.Id = objCont.Id;
                    newContact.Account_Status_BG__c = objCont.Account.Membership_Defined__c;
                    contactToBeUpdate.add(newContact);
                }
            }
            if(contactToBeUpdate.size() > 0){
                UPDATE contactToBeUpdate;
            }
        }
        
    }
    
}
Hi there,

Can someone help with test class for below two Apex class??

@RestResource(urlMapping='/CaseAttachment/*')
global with sharing class CaseAttachment{

@HttpGet
    global static List<Attachment> getCaseById() {
       RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
          List<Attachment> result =  [Select id, Name, OwnerId, BodyLength, LastModifiedById, LastModifiedDate, ContentType, Body, Description, CreatedDate, CreatedById from Attachment where ParentId = :Id];
        return result;
        }
           
@HttpPost
  global static void doget(String type, String body, String ContentType, String ParentID ){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String CaseName=req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        String doc=EncodingUtil.Base64Encode(req.requestBody);
         Attachment a = new Attachment();
            a.Name = type;
            a.Body = Blob.valueOf(body);           
            a.ContentType = ContentType;
            a.ParentId = 'Id';
                
        insert a;
        
    }
}

and-------------------------------------------------------------------------------------------------------

@RestResource(urlMapping='/QueryFilterStatus/*')
global with sharing class QueryFilterStatus{
    
    @HttpPost
    global static List<Case> dopostCase(String Owneremail, String Bugis, String Version, String accountid,String tracker,String priority,String contactEmail,String status,String CStatus,String subject, String Keyword) {
    List<Case> caseList = new List<Case>();
    String str='Select id, Case_Owner_Name__c, OwneEmail__c, Description, Subject, Case_Type__c, Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail, ContactId, OwnerId, CaseNumber, CSM_ID__c, CUP_Phone__c, Call_Type__c, IsClosed from Case where accountid =\''+ accountid +'\'';
    
    if(String.isNotBlank(Owneremail))
    {
       str+=' AND OwneEmail__c=\''+ Owneremail+'\'';
    }
    if(String.isNotBlank(Bugis))
    {
       str+=' AND BugIs__c=\''+ Bugis+'\'';
    }
    if(String.isNotBlank(Version))
    {
       str+=' AND Version__c=\''+ Version+'\'';
    }
    
    if(String.isNotBlank(tracker))
    {
       str+=' AND Tracker__c =\''+ tracker+'\'';
    }
     if(String.isNotBlank(priority))
    {
       str+=' AND Priority=\''+ priority+'\'';
    }
     if(String.isNotBlank(contactEmail))
    {
       str+=' AND ContactEmail=\''+ contactEmail+'\'';
    }
     if(String.isNotBlank(status))
    {
       str+=' AND Status =\''+ status+'\'';
    }
    
    if(String.isNotBlank(CStatus))
    {
       str+=' AND CStatus__c=\''+ CStatus+'\'';
    }
    
    //if(String.isNotBlank(subject))
    //{
    //   str+=' AND Subject Like \''+ subject+'\'';
   // }
    
    //if(String.isNotBlank(description))
    //{
     //  str+=' AND Description Like \''+ description+'\'';
    //}
    if(String.isNotBlank(Keyword))
   {
      str+=' AND (Subject Like\'%'+ Keyword+'%\'';
      str+=' OR CaseNumber Like \'%'+ Keyword+'%\')';
   }  
   System.debug(str);
    caseList=Database.query(str);
    return caseList;
    
    
}
}



 
Hi,

I am looking forward to learn cloud commerce. Is there a developer edition of the app I can install in salesforce? What are the steps.

Thanks,
Mayank Batra
Hi there,
I am struggling to write a test class for below, can some help on this asap?

@RestResource(urlMapping='/CaseAccountid/*')
global with sharing class CaseAccountid{

@HttpGet
    global static List<Case> getCaseById() {
       RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
          List<case> result =  [Select id, IsEscalated, Case_Owner_Name__c, OwneEmail__c, subject, Case_Type__c, Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail, ContactId, OwnerId, CaseNumber, CSM_ID__c, CUP_Phone__c, Call_Type__c from Case where AccountId = :Id];
        return result;
    }
}
public class AccountTriggerHandlerEx3 {

    public static void onBeforeInsert(List<Account> accountList){
       populateOpp(accountList);
    }
       
    public static void populateOpp(List<Account> accountList){
        for(Account acc : accountList){
            if(acc.shippingAddress == Null){
                if(acc.BillingCountry == 'US' || acc.BillingCountry == 'USA' || acc.BillingCountry == 'CA'){
                           acc.ShippingStreet             = acc.BillingStreet;
                        acc.ShippingCity               = acc.BillingCity;
                        acc.ShippingState             = acc.BillingState;
                        acc.ShippingPostalCode         = acc.BillingPostalCode;
                        acc.ShippingCountry         = acc.BillingCountry;
            }
        }
            if(acc.BillingCountry == 'PH' || acc.ShippingCountry == 'PH'){
            if (acc.Phone != Null || acc.phone != ''){
                if(acc.Phone.substring(0,3) != '+63'){
                    acc.Phone.addError('Philippine telephone numbers must be prefixed with the Country Code +63');
                }
                           
            }  
            }
        
        if(acc.BillingCountry == 'PH' || acc.ShippingCountry == 'PH'){
            if (acc.Fax != Null || acc.Fax !=''){
                if(acc.Fax.substring(0,3) != '+63'){
                    acc.Fax.addError('Philippine Fax numbers must be prefixed with the Country Code +63');
                }
                           
            }  
            }}
    }


      public static void onAfterUpdate(List<Account> accountSet){
       populateOppp(accountSet);
    }

    private static void populateOppp(List<Account> accountSet){
        List<Id> accountIds = new List<Id>();
        for(Account acc : accountSet){
          
        Account old = (Account)trigger.oldMap.get(acc.Id);
        if (acc.billingstreet != old.billingstreet|| acc.billingcity !=old.billingcity || acc.billingstate !=old.billingstate || acc.billingcountry != old.billingcountry) {
            accountIds.add(acc.Id);
        }
            
        }  
        if (accountIds.size() > 0) {
        contact[] updates = [select Id, accountId from contact where accountId in :accountIds];
        for (contact c : updates) {
            Account a = (account)trigger.newmap.get(c.accountId);
            c.mailingStreet = a.billingStreet;
            c.mailingcity = a.billingcity;
            c.mailingstate = a.billingstate;
            c.mailingpostalcode = a.billingpostalcode;
            c.mailingcountry = a.billingcountry;
                    }
        update updates;
    }                                                   
    
    
    }
    

}
  • January 10, 2019
  • Like
  • 0
I have a Lightning component that I use in a Flow that opens the new record the Flow creates.  It works in a screen Flow, but not in an auto-launched Flow.  I get this error:  OpenNewRecord (Action Call) - The action type "Local Actions" can't be used in flows with the process type "Autolaunched Flow". 
Is there a way to change the component so that I can use it in an auto-launched Flow?
There is a command in VS Code called SFDX: Push Source to Default Scratch Org.

What is the command to merge the code from the Scratch Org to the Real Org using VS Code or the SFDX cli?

Or is there some way you do it in Salesforce UI?
I have system administartor profile in the Salesforce Org. 
when i compose a new email, and click on the Lightning for outlook addin i get the following error 

User-added image

I can log read emails successfully. However the permission errror is only when composing new emails. 

Am i missing some permissions? 

Note: I downloaded the lightning for outlook from the microsoft app store - 

https://appsource.microsoft.com/en-us/product/office/WA104379334?src=office&corrid=09018e6b-cb7d-4dd7-96d9-c293bc65fd64&omexanonuid=d60d704b-d83c-45ef-b99c-bae14a3ed2d8&referralurl=https%3a%2f%2fappexchange.salesforce.com%2fappxlistingdetail%3flistingid%3da0n3a00000dqd3fuav
 
Hello,

I have an Emailtemplate and a Attachment is added to it,
When i click on the email attachment, it givesme below error.

What can be the reason ?

Thank you 
User-added image
Hi All,
         my test class is giving following error:-Constructor not defined: [CloneOpportunityController].<Constructor>()
Test class is given below:-

@istest
public class CloneOpportunityControllerTest {
    Static testmethod void cloneOppTest(){
        String currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        test.startTest();
        Account a = new Account(Name='newAcct'); 
        insert a; 
        
        Opportunity oppt = new Opportunity(Name ='New opp',
                                           AccountID = a.ID,
                                           StageName = 'Customer Won',
                                           CloseDate = System.today()+10,
                                           Amount = 3000
                                          );
        insert oppt;
        
        Opportunity_Qualifier__c oq = [Select id, Opportunity_Name__c 
                                       from Opportunity_Qualifier__c 
                                       where Opportunity_Name__r.Id =: oppt.Id];
        
        Top_Business_Priorities_and_Outcomes__c tb  = new Top_Business_Priorities_and_Outcomes__c();
        tb.Opportunity_Qualifier__c = oq.Id;
        insert tb;
        
        Identified_Pain_MEDDIC__c ipMedicToInsert = new Identified_Pain_MEDDIC__c();
        ipMedicToInsert.Opportunity_Qualifier__c = oq.Id;
        insert ipMedicToInsert;
        
        Decision_Making_Role_MEDDICC__c dmRoleToInsert = new Decision_Making_Role_MEDDICC__c();
        dmRoleToInsert.Opportunity_Qualifier__c = oq.Id;
        insert dmRoleToInsert;
        
        Decision_Criteria__c dcToInsert = new Decision_Criteria__c();
        dcToInsert.Opportunity_Qualifier__c = oq.Id;
        insert dcToInsert;
        
        Competition_MEDDICC__c cmMedicToInsert = new Competition_MEDDICC__c();
        cmMedicToInsert.Opportunity_Qualifier__c = oq.Id;
        insert cmMedicToInsert;
        
        Relevant_Case_Studies_MEDDICC__c rcsMedicToInsert = new Relevant_Case_Studies_MEDDICC__c();
        rcsMedicToInsert.Opportunity_Qualifier__c = oq.Id;
        insert rcsMedicToInsert;
        
        Decision_Process_MEDDICC__c dpMedicToInsert = new Decision_Process_MEDDICC__c();
        dpMedicToInsert.Opportunity_Qualifier__c = oq.Id;
        insert dpMedicToInsert;
        
        UA_Teammate_Role__c uateamMateToInsert = new UA_Teammate_Role__c();
        uateamMateToInsert.Opportunity_Qualifier__c = oq.id;
        insert uateamMateToInsert;
         
        PageReference pageRef = Page.CloneOpportunity; 
        pageRef.getParameters().put('id', oppt.id);
        Test.setCurrentPage(pageRef);
        CloneOpportunityController co = new CloneOpportunityController();
        co.cloneOpportunity();
        test.stopTest();
     }          
     }
how to sove this error?
Any suggestions?
list<ProcessInstanceWorkitem> workItems = [SELECT Id,ProcessInstance.TargetObjectId,actorid,createddate,CreatedById
FROM ProcessInstanceWorkitem WHERE actorId = '00537000000GePo' and  
                                       ProcessInstance.Status = 'Pending' and 
                                       (createddate> 2018-01-01T01:00:00Z and createddate< 2018-04-30T01:00:00Z) ]; 

system.debug('what is this'+workItems.size());

list<Approval.ProcessWorkitemRequest> y = new list<Approval.ProcessWorkitemRequest>();
Set<Id>tId = new Set<Id>();

for(ProcessInstanceWorkitem ccc : workItems){
    tId.add(ccc.id);
    
}

list<Id> sdcc = new list<Id>();

for(Id ff : tId){
    
    sdcc.add(ff);
}
for(integer i = 0; i< sdcc.size(); i++){
    Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();  

pwr.setAction('Removed');
 pwr.setWorkItemId(sdcc[i]);
    pwr.setNextApproverIds(new Id[] {'00537000000GePo'});
     Approval.process(pwr);

}
Hello,

Can anyone please let me how to make Salesforce as an authenticator for my application?

Like trailhead/workbench/many other applications/dataloader gives option of "login through Salesforce", similarly I need a  functionality where in my user can get logged into my application if he's a valid Salesforce user.

Br,
Rumit
Hello,

I have two JSON, one I have generated based on my org data, and another I Ihave received from another system.

​​​​​​I have to compare each and every record present in these JSONs. I have unique external ID defined in every record (which can be used while comparing). Finally I have to make a list of similar and dis-simmilar records.


Can anyone suggest, how I can accomplish this task?
​​​​​​
Br,
Rumit
While trying to push code using SFDX. I am getting below error. Please help if any one faced this error.


WARNING: apiVersion configuration overridden at 44.0
PROJECT PATH ERROR
──────────── ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
N/A An object 'OrgComparer' of type LightningComponentBundle was named in package.xml, but was not found in zipped directory
02:26:12.128 sfdx force:source:push ended with exit code 1
Hi All ,

I need to write test class for below code please help me it is very urgent.


public class QueueAssignController{

    Public List<SelectOption> QueueList {get;set;}
    public List<Group> GroupNameList {get;set;}
    Public list<GroupMember> mlist  {get;set;} 
    public String queue {get;set;}
    public String queueid {get;set;}
    public List<String> selectedUserIds { get; set; }
    public List<String> removedUserIds { get; set; }
    public String whereClause { get; set; }
    public String AccName {get;set;}
    private Map<Id, String> availableUsersMap;
    private Map<Id, String> selectedUsersMap;
    
    
    

    public  QueueAssignController(ApexPages.StandardController std) {
        initializeCollections();
        
         ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;
           // Pid = [Select ProfileId from User where id =: Userinfo.getUserid()].ProfileId;
           String  aid = [Select AccountID from Contact where id =: contactid].AccountId;
        
       // String aid=ApexPages.currentPage().getParameters().get('id');
      List<String> accName=new List<String>();
     account[] a=[select WFSSFriendlyName__c from account where id=:aid limit 1    ];
        String wffs=a[0].WFSSFriendlyName__c;
        GroupNameList = new List<Group>();
        String j='%'+wffs+'%';
        GroupNameList = [select g.Id, g.Name from Group g where Type = 'Queue' AND name like:j Order by Name Asc];
        QueueList = new List<SelectOption>();
        for(Group temp : GroupNameList)
         {
          queueid = temp.id;
          QueueList.add(new SelectOption(temp.Id, temp.Name));
         }
        if(queue  == null){
            queue = queueid;
            getUsers();
        }
         system.debug('QueueList++++++'+QueueList);
         system.debug('queue ++++++'+queue );
    }
        
    public PageReference UpdateList() {
        initializeCollections();
        getUsers();
        return null;
    }
   public void filterAvailableOptions() {
        availableUsersMap = new Map<Id, String>();
        selectedUserIds = new List<String>();
       string userid =userinfo.getUserId();
       user[] uac=[select AccountId from user where id=:userid limit 1];

        String likeClause = '%' + whereClause + '%';
        for (User u : [SELECT id, name FROM User WHERE name like :likeClause AND Name!='Chatter Expert'  AND IsActive = true order by Name Asc]) {
            if (!selectedUsersMap.containsKey(u.Id)) {
                availableUsersMap.put(u.Id, u.Name);
            }
        }
    }
    public void add() {
        if (!selectedUserIds.isEmpty()) {
            for (String userId : selectedUserIds) {
                selectedUsersMap.put(userId, availableUsersMap.get(userId));
                availableUsersMap.remove(userId);
            }
        }
    }

    public void remove() {
        if (!removedUserIds.isEmpty()) {
            for (String userId : removedUserIds) {
                availableUsersMap.put(userId, selectedUsersMap.get(userId));
                selectedUsersMap.remove(userId);
            }
        }
    }

    public List<SelectOption> getAvailableUsers() {
        
        List<SelectOption> availableUsers = new List<SelectOption>();
        for (Id userId : availableUsersMap.keySet()) {
            availableUsers.add(new SelectOption(userId, availableUsersMap.get(userId)));
        }
        return availableUsers;
    }

    public List<SelectOption> getSelectedUsers() {
        List<SelectOption> selectedUsers = new List<SelectOption>();
        for (String userId : selectedUsersMap.keySet()) {
            selectedUsers.add(new SelectOption(userId, selectedUsersMap.get(userId)));
        }
        return selectedUsers;
    }

    private void initializeCollections() {
        selectedUserIds = new List<String>();
        removedUserIds = new List<String>();
        availableUsersMap = new Map<Id, String>();
        selectedUsersMap = new Map<Id, String>();
    }

    private void getUsers() {
        QueueSobject qs = [SELECT QueueId,SobjectType FROM QueueSobject where QueueId=:queue];
        list<GroupMember> gms = [SELECT Group.Name,UserOrGroupId FROM GroupMember WHERE Group.Type = 'Queue' AND GroupId =:qs.QueueId];
        system.debug(gms);
        set<id> gids =new set<id>();
        for(GroupMember g:gms){
            gids.add(g.UserOrGroupId);
        }
          String aid=ApexPages.currentPage().getParameters().get('id');
        list<user> urs = [SELECT id, Name FROM User where IsActive = true AND id NOT IN:gids AND Name!='Chatter Expert' AND AccountId=:aid order by Name Asc];
        system.debug(urs);
        for(user u : urs){
             availableUsersMap.put(u.Id, u.Name);
        }
         list<user> urss = [SELECT id, Name FROM User where IsActive = true AND id IN:gids AND Name!='Chatter Expert' order by Name Asc];
        system.debug(urs);
        for(user ur : urss){
             selectedUsersMap.put(ur.Id, ur.Name);
        }    
    }
    public PageReference savenew(){
        List<GroupMember> groups = new List<GroupMember>();
        List<GroupMember> groupss = [select Id from GroupMember where Group.Type = 'Queue' and GroupId =:queue ];
        if( !groupss.isEmpty() )
        {
            delete groupss;        
        }
        if(selectedUsersMap.size() == 0){
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.Error, 'Please select a user to Add to Queue') );
        }
        else{
            for(id ids:selectedUsersMap.keyset()){
              // ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO, 'Added user to Queue'+queue) );
              insert new GroupMember( GroupId = queue , UserOrGroupId = ids); 
            }
           }
        return null;
        }
}
This site can’t be reached
harshaljagdale-dev-ed--c.visualforce.com’s server IP address could not be found.
Try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN


I am not able to open vf page
Hello everybody,  its my first time dealing with outbound messge and my first time with web service.
I need know if its posible to set a local endpoint, i.e if my endpoint can be a localhost direction. If it is possible can give some tutorial?

Thx.
I have a lookup field that is formatted as a hyperlink. This is fine on the page layout, but when I try to use the field in an email template, instead of the text, I get the text surrounded by the <a href> tag in the body of the message. I do not need or want the link in my email notification. I just want the text that appears in the field to appear on the message. Is there a way I can do this without creating a duplicate field on the object?
Hello all,
I'm trying to create a custom apex controller for a visualforce page, but no matter what i've tried, I cannot create an apex class in the developer console.  I am using a developer account, and am working in a developer org, and I still can't create apex classes. Is there something I am missing? Is there any alternative I can try to develop an apex class? 

Thank you in advance,
Connor
It is happening on the MAP_Line_Item_Forecast__c  I dont understand why I get this error. I am new to Apex. Here is the code below
public List<MAP_Line_item_Forecast__c> queryLineItems(Set<Id> dealIds, Set<Id> leaseIds, Set<Id> actualsWithoutLeaseIds, Set<String> buildingUnitsForSpecs) { 
      system.debug('buildingUnitsForSpecs: ' + buildingUnitsForSpecs);
        return [select Id, BuildingUnit__c, Building__c, DBA__c,
            Lead_Id__c, Latest_Amendment_Deal__c, Is_Perm_Activity__c, Square_Footage__c, Category_Code__c, 
            LOB__c, Lob__r.Lob_Name__c, Lob__r.Business_Group__c, lob__r.Parent_LOB__c, lob__r.parent_lob__r.id,
            Lease_Id__c, Lease_Id__r.RecordTypeId, Lease_Id__r.RecordType.Name, 
            Deal_Id__r.Atm__c, Deal_Id__r.Kiosk__c, Deal_Id__r.Antenna__c, Deal_Id__r.RecordTypeId,Deal_Id__r.RecordType.Name, deal_id__r.StageName,
            Start_Date__c, End_Date__c, Date_of_Possession__c, Unit__c, MAP_Line_Item_Source__c, Company__c,
            isActive__c, // necessary so we can check the field as line items are updated for overlap 
            (select Id, Year__c,
                Jan__c, Feb__c, Mar__c, Apr__c, May__c, Jun__c, Jul__c, Aug__c, Sep__c, Oct__c, Nov__c, Dec__c,
                Jan_Actual__c, Feb_Actual__c, Mar_Actual__c, Apr_Actual__c, May_Actual__c, Jun_Actual__c, Jul_Actual__c, Aug_Actual__c, Sep_Actual__c, Oct_Actual__c, Nov_Actual__c, Dec_Actual__c 
                from MAP_Monthly_Forecast_Stats__r) 
            from MAP_Line_Item_Forecast__c 
            where isActive__c = true and ( 
                ( Deal_Id__c in :dealIds ) 
                or ( Lease_Id__c in :leaseIds )
                or ( Actual_Id__c in :actualsWithoutLeaseIds )
                //or ( Latest_Amendment_Deal__c in :amendedDealIds ) 
                or ( MAP_Line_Item_Source__c = :MAP_Constants.MAP_LINE_ITEM_SOURCE_SPEC_DEAL and BuildingUnit__c in :buildingUnitsForSpecs)
            )];
  }

 
I need help changing my APEX trigger Im getting the following error message  

MassLeadConverterControllerTest
massLeadTest
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Health_Score_Calculation_New: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.Health_Score_Calculation_New: line 12, column 1: [] 
Stack Trace: Class.MassLeadConverterControllerTest.massLeadTest: line 11, column 1


Below is the Trigger 

trigger Health_Score_Calculation_New on Account (before insert) {
  if(Trigger.isBefore)
  {
    if (Trigger.isInsert || Trigger.isUpdate)
     {
       for(Account cob : trigger.new)

         {
            cob.Score__c = (cob.Implementation__c * 0.15) + 
                           (cob.Migration_In_Progress__c * 0.20) + 
                           (cob.Days_With_No_Activity__c * 0.15) + 
                           (cob.Contact_New_Rollup__c * 0.15) + 
                           (cob.Contact_Left_Rollup__c * 0.15) + 
                           (cob.Issues__c * 0.20) ;
           }
       }
    }
}

Hello,  I am new in this Forum.  I would like to ask for some help.    I would like to create an automatic task to change the account status when the account has not won an opportunitty in a specific period such as 100 day.  I would like to create an task to inform the user to take action. 

Regards  

Hi,
Need help with below Validation rule
OR(ISPICKVAL(PRIORVALUE(StatusCode, "Activated")),
ISPICKVAL(StatusCode, "Activated"))

Error: Error: Incorrect number of parameters for function 'PRIORVALUE()'. Expected 1, received 2
Regards,
Sony
I have a lighting input - type:date and I wann change this messages? Can anyone show me ?

User-added image
Is it possible to deploy an unmanaged package created from a Developer ORG to a production org. The reason being is that as you know, you cannot create a Sandbox ORG with a Developer ORG. And you cant create code "directly" on a production server
I have a requirement that ananymous user who doesn't requre login to access a page, fills the details, saves to an object (custom, and it has lookup field  to contact) . For this I have done the below steps
  • Added Domain
  • Created new Site
  • Assigned the created VF page in to the list 'Site Visualforce Pages'
  • Activated the site
  • Gave perrmissions (RWA) to the custom object
But when I click on the page I got the following error
Authorization Required

You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.
We should directly access to the page without authorize, how can we do this?
Thanks,