• Sabrent
  • SMARTIE
  • 1440 Points
  • Member since 2011

  • Chatter
    Feed
  • 46
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 242
    Questions
  • 672
    Replies
We have some strict requirements on account sharing amongst sales teams members in our org. I have created a custom object which holds the rules of who can see which account based on the Owner on the account. I wrote a trigger which makes use of AccountTeamMember object. Everything is working fine. However I would like to bulkify my trigger but have not been able too after a few attempts.
Below is part of my trigger I would like to bulkify: (the rest of it has code unrelated to account sharing).
Could someone suggest a solution?

Thank you
List<AccountTeamMember> atmToAdd = new List<AccountTeamMember>();

for (Account a : trigger.new) 
{
	//Custom object holding sharing rules
	SharingRuleMap__c[] sMap = [SELECT SharingWith_ID__c, 
										TeamMemberRole__c, 
										AccountAccessLevel__c, 
										ContactAccessLevel__c, 
										CaseAccessLevel__c, 
										OpportunityAccessLevel__c 
								   FROM SharingRuleMap__c
								  WHERE Dealing_Rep__c = :a.OwnerId];
	 
	if (sMap.size() > 0) 
	{ 
		For (Integer i=0; i<sMap.size();i++) 
		{
			AccountTeamMember atm = new AccountTeamMember();
			atm.AccountId = a.Id;
			atm.UserId = sMap.get(i).SharingWith_ID__c;
			atm.TeamMemberRole = sMap.get(i).TeamMemberRole__c;
			atm.AccountAccessLevel = sMap.get(i).AccountAccessLevel__c;
			atm.ContactAccessLevel = sMap.get(i).ContactAccessLevel__c;
			atm.CaseAccessLevel = sMap.get(i).CaseAccessLevel__c;
			atm.OpportunityAccessLevel = sMap.get(i).OpportunityAccessLevel__c;
			atmToAdd.add(atm);
		}
	}
}

insert atmToAdd;

 
Hello,

I need the trigger below to only find the duplicate record if the Status__c is 'Active' on both records. Status__c is a picklist field. Any assistance is greatly appreciated!
trigger DuplicateExecutiveContact on Committee_Board_Member__c (before insert. before update) {
        for(Committee_Board_Member__c c:Trigger.new)
        {
      
            List<Committee_Board_Member__c> comm=[select ID from Committee_Board_Member__c where Account__c=:c.Account__c and Committee_Board__c=:c.Committee_Board__c and Service_Discipline__c=:c.Service_Discipline__c and Status__c=:c.Status__c];
            if(comm.size()>0)
            {
                c.adderror('Duplicate Record');
            }
        }
    }

 
  • April 09, 2019
  • Like
  • 0
Hi

I am Beginner in Salesforce
I am trying to this Scenario but how to start i dont know 
So Please Help Me I am new In Salesforce
My Question is:
 my checkbox name is Display Amount when i clicked on checkbox  then one custom field is appear  field name is Amount and when unchecked the checkbox then field will be not appear
Please help me

Thanks in Advance
Neeraj Sharma
I am trying to build a page to clone a record.  I have the page and I am able to pass the current record to the new component in an attribute but I'm really struggling to figure out how I can take the values from that one record and populate x number of dummy records with the values.  I am new to javascript. 
 
What I have so far is the variable "CloneGS" which does get populated with the record.  I was trying to loop through x number of times (eventually, that number will also get passed from the original component) and then add a record to my attribute, "newgroupstructures" and then display these on the page so they can be edited and then created.
 
Any help would be greatly appreciated!!!!  thanks!!!  Fred
 
Here is my component:
 
  
<!-- here is the variable to hold thegroup structure that gets passed from the GroupStructures Component (that was clicked) -->
 <aura:attribute name="existinggroupstructure" type="Group_Structure__c" />
    <aura:attribute name="newGroupStructures" type="Group_Structure__c[]"/>
 
    <!-- Handle component initialization in a client-side controller -->
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
 <!-- <aura:handler event="c:GSCloneRecords" action="{!c.createGS}" />  -->
   
    <aura:iteration items="{!v.newGroupStructures}" var="gs">
  <p>{!gs}</p>
 </aura:iteration>
Here is my controller:
Here is my doInit controller:
 
doInit : function(component, event, helper) {
    
        //variable for the record that we are cloning from the component
        var CloneGS = component.get("v.existinggroupstructure");
 
 //variable to hold the new records
        var gs = [];
    
      //Loop through and create 5 rows with same field data in the
        for(var i = 0;i < 5;i++){
            // doesnt work.... gs.push({'Name':'Test'+i, 'Group_Number__c': testfield});
            gs.push({'Name' : 'Test'+i});
         }
   component.set("v.newGroupStructures",gs);
  },


 
  • October 26, 2018
  • Like
  • 0
The "Search in Files" feature is particularly irritating because it doesn't search components.
Also, the debug logs won't show the last few lines without jumping back up the list.
The "Search"  box overlays the horizontal scroll bar.
Hi, I am new to salesforce i am finding difficulty in writing trigger.
I have 2 fields named 'Claim' on Account and Contract Object. Account is the parent record(Lookup Relationship).
How to automatically update the claim field of Account object with the Contract claim field using trigger.
Thanks in advance.
I'm trying to mass update a specific field using developer's console, but I only end up deleting the record itself. Here is my code: 

Contact[] contactDel = [SELECT Email__c FROM Contact
   WHERE Join_Date__c <= '2000'
   AND Email__c LIKE '%it.work.com’];

delete contactDel;

I'm currently trying to mass delete an email field that ends with "it.work.com," but only from people who joined on or before the year 2000. I don't want to necessarily remove the field from the record, but just delete the entry so that it's blank. However, this ends up deleting the whole record. Is there another way to do this? Maybe such as retrieving the ID's of these record? 
Issue: Below trigger forwards opp if opp name contains "TrailHead", our users are entering "Trailhead" and opp is not forwarding, it's getting forwarded if i use "TrailHead", i have used contains so why is my trigger using case sensitive?

Trigger AutoforwardOpp on Opportunity(after insert, after update)
{
    List <PartnerNetworkRecordConnection> prncList;
    List <PartnerNetworkConnection> connectionList;
    Map <ID, PartnerNetworkConnection> connMap;
    Map <ID, ID> oppIdvsAccountIdMap;
    Map<ID, Account> accountWithContactMap;
    
    ID cid;
    String status;
    String connName;

    if(Trigger.isafter  && (Trigger.isInsert || Trigger.isUpdate)){
            
        connectionList = new List<PartnerNetworkConnection>();
        prncList = new List<PartnerNetworkRecordConnection>();
        
        //This would ideally return multiple active Connections if they exist hence its best you use a
        //criteria to ensure only the appropriate connection record is returned.
        connMap = new Map<ID, PartnerNetworkConnection>(
            [Select ID, ConnectionStatus, ConnectionName
             From PartnerNetworkConnection
             Where ConnectionStatus = 'Accepted']);
        
        //get connection details        
        for(ID connId :connMap.keySet()){
            cid = connMap.get(connId).ID;
            status = connMap.get(connId).ConnectionStatus;
            connName = connMap.get(connId).ConnectionName;
        }
        
        //Populate a map of Opp Ids and associated Account Ids
        oppIdvsAccountIdMap = new Map<ID, ID>();
        for(Opportunity oppRecord :Trigger.new){
        
            if(oppRecord.Name.contains('TrailHead')){
                    //System.debug('Opp Id: ' + oppRecord.ID + '-> Account Id: ' + oppRecord.AccountId);
                    oppIdvsAccountIdMap.put(oppRecord.ID, oppRecord.AccountId);
            }
        }
        
        //Get associated Accounts and Contacts for every US opportunity if they exist
        if(oppIdvsAccountIdMap.keySet().size() > 0){
        
            accountWithContactMap = new Map<ID, Account>(
                [Select ID, Name,
                    (Select ID, Name, Account.Id From Account.Contacts)
                 From Account
                 Where ID IN :oppIdvsAccountIdMap.values()]);

            //Create PartnerNetworkRecordConnections for sharing the records
            for(ID oppId : oppIdvsAccountIdMap.keySet()){
            
                ID accountId = oppIdvsAccountIdMap.get(oppId);
                
                //Share Opportunity
                prncList.add(new PartnerNetworkRecordConnection(
                    ConnectionId = cid,
                    LocalRecordId = oppId,
                    SendClosedTasks = true,
                    SendOpenTasks = true,
                    SendEmails = true));
                
                //Share Account
                if(oppIdvsAccountIdMap.get(oppId) != null){
                
                    prncList.add(new PartnerNetworkRecordConnection(
                        ConnectionId = cid,
                        LocalRecordId = accountId,
                        SendClosedTasks = true,
                        SendOpenTasks = true,
                        SendEmails = true));
                }
                
                //Share associated Contacts
                if(accountWithContactMap.get(accountId).Contacts != null){
                                   
                    for(Contact contact :accountWithContactMap.get(accountId).Contacts){
                    
                        prncList.add(new PartnerNetworkRecordConnection(
                            ConnectionId = cid,
                            LocalRecordId = contact.ID,
                          //ParentRecordId = Contact.AccountId,
                            SendClosedTasks = true,
                            SendOpenTasks = true,
                            SendEmails = true));
                    }
                }
            }
            
            //Insert record connections
            if(!prncList.isEmpty()){
            
                try{
                    insert prncList;
                }
                catch(System.Dmlexception dmlExceptionInstance){
                    System.debug('Record Share Error:' + dmlExceptionInstance.getMessage());
                }
            }
        }
    }
}
When deploying some updates to exiting apex classes, the deploy is failing because it says 0% code coverage. When I check coverage in the developer console it shows 83% coverage. Not sure what is going on. This just starting happening this week, I deployed a few changes last week without issue. Nothing has been changed or packages added in the meantime. I've had this issue in the past, but usally went away after 24 hours. Any ideas? Is this a bug?
I used Below codes  i didn't get any result

Decimal toRound = 3.14159265359;   
Decimal rounded = Math.round(toRound, 2);
system.debug(rounded);

Decimal toround = 3.14159265;
Decimal rounded = toround.setScale(2);
system.debug(rounded);

Hi,

 

I am very much new to the salesforce

 

I am creating recruiting app using a following book

http://www.salesforce.com/us/developer/docs/fundamentals/salesforce_creating_on_demand_apps.pdf

 

in its security and sharing data section I have created a user Phil Katz, and trying to make this as a DBA owner as per the steps given in the book but I am getting error saying

 

Transfer Requires Read The new owner must have "Read" permissions on this type of record.

Click hereto return to the previous page.

 

how to get it resolved, how to provide read access to this new user.

 

please suggest

 

Thanks,

Manish.

Hi,

 

I have a field with check box. If it is ticked, then the user has to fill the text box, else not required.

How can I configure it ?

 

Your help needed.

 

Regards,

Blue

Hi

 

Interview question:Can we use the check box in dependent picklists?Can anybody help me?

I'm trying to create a field at the Opportunity Product level that divides the "Total Price" by the number of months in the contract (at the opp level). However, I only want it to calculate if the Product Name is not equal to "Cart".

 

IF(PricebookEntry.Product2.Name <> "Cart",TotalPrice/Opportunity.Months_in_Contract__c)

 

I keep getting an error that says I have an incorrect number of parameters for function IF(). Expected 3, received 2.

 

Any help would be very much appreciated!

 

 

HI  -

I created a text field and now I want to have it default to "no".  There's no data in it yet, so is there a way to edit the field and set the Default value?

I feel like I've done this before, but I can't remember or find it.

 

Thanks -

Sara

  • October 24, 2012
  • Like
  • 0

As of today, I cannot deploy change sets from my sandbox (cs11) to the sandbox (cs10) site. I get emails that the upload worked but it just doesnt apper in the list of inbound change sets.  Any Infos about this issue? 

 

 

Thanks

 

Diego Moreira

 Where can I find a test class written for a particular apex class.......I can only see the code covered for a particular class but unable to find the test class for it..... 

Hello
I´m new with visualforce and I need to create an email template to show data of the opportunity, show the related quote and show the list of a custom object (call CE) that is related to the quote. The next is an example of what a need:

 

- Quote has a relation master detail with opportunity
- CE (My_custom_object) has a relation master detail with quote

 

Dear {!recipient.Name}

 

{!Opportunity.Name}
{!Opportunity.closeDate}
{!Quote.name}
{!Quote.date}

 

(here I need to show a table with the list of items of my custom object)
Code- Name - Date

 

I hope you understand me. I appreciate your help.

I have not written this Apex class however i need to write a test class and wondering if some one can guide . 

 
global with sharing class MuleOppCategoryApi {
    private static Map<String, MuleApiSetting__mdt> muleSoftApiMetaDataMap = MuleApiSetting__mdt.getAll();

    @InvocableMethod(label='getOppCategories' description='Invocable Apex Class to get opp Categories for a opp Id' callout = true)
    public static List<Result> getOppCategories(List<String> oppIdList){
        List<Result> apiCallResult = new List<Result>();

        if(oppIdList != Null && oppIdList.size() > 0 ){
            string oppId = oppIdList[0];  
            system.debug(LoggingLevel.ERROR, 'Opp Id:: ' + oppId);

            Opportunity oppRecord = [Select Id, System_Opp_Number__c from Opportunity where Id = :oppId LIMIT 1];
            system.debug(LoggingLevel.ERROR, 'System Opp Number:: ' + oppRecord.System_Opp_Number__c);

            apiCallResult.add(getDealCategoriesData(oppRecord));        
        }       

        return apiCallResult;
    }

    Public static Result getOppCategoriesData(Opportunity oppRecord){
        Status callStatus;
        
        if(MuleApiMetaDataMap != Null && MuleApiMetaDataMap.size() > 0){   
            try {
                Result accessTokenApiCallResult = getAccessToken();                             //Get Access Token using api
                if(accessTokenApiCallResult.status.isSuccess){
                    Result oppApiCallResult = getOppRecord(oppRecord.System_Opp_Number__c, accessTokenApiCallResult.accessToken);         //Get Opp Record with Categories data using api
                    if(oppApiCallResult.status.isSuccess){
                        processoppRecord(oppRecord.Id, oppApiCallResult.oppRecord);
                    }

                    return oppApiCallResult;
                }else{
                    return accessTokenApiCallResult;
                }
            } catch (Exception e) {
                callStatus = new Status(false, 'Exception', e.getMessage());
            }
        }else{                                                                                  //return error: Custom Metadata - MuleApiSetting__mdt not set            
            callStatus = new Status(false, 'API Settings Not Found', 'Custom metadata - MuleApiSetting__mdt records not found');            
        }

        return new Result(callStatus, null, null);              
    }

    private static Result getAccessToken(){    
        String accessToken;
        boolean isSuccess = true;
        String errorCode = null;
        String errorMsg = null;
        Status callStatus;
        Result result;
        MuleApiSetting__mdt apiSettings = MuleApiMetaDataMap.get('OppCategoryTokenApi');
        
        if(apiSettings != Null && String.isNotEmpty(apiSettings.End_Point_Url__c) && String.isNotEmpty(apiSettings.Client_Id__c) 
            && String.isNotEmpty(apiSettings.Client_Secret__c)){            
            HttpRequest req = new HttpRequest();
            req.setEndpoint(apiSettings.End_Point_Url__c);
            req.setMethod('POST');

            Blob headerValue = Blob.valueOf(apiSettings.Client_Id__c + ':' + apiSettings.Client_Secret__c);
            String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
            req.setHeader('Authorization', authorizationHeader);
            req.setHeader('Content-Type', 'application/x-www-form-urlencoded');

            Http http = new Http();
            HTTPResponse res = http.send(req);

            Integer httpResonseStatusCode = res.getStatusCode();
            if(httpResonseStatusCode == 200){
                String tokenResponseBody = res.getBody();
                Map<String, Object> tokenResponseBodyMap = (Map<String, Object>)JSON.deserializeUntyped(tokenResponseBody);
                accessToken = String.valueOf(tokenResponseBodyMap.get('access_token')); 
            }else{                                                                         //Api error
                isSuccess = false;
                errorCode = String.valueOf(httpResonseStatusCode);
                errorMsg = res.getBody();
            }
                       
        }else{                                                                             //Settings data issue error
            isSuccess = false;
            errorCode = 'API Setting Not Found';
            errorMsg = 'Record - OppCategoryTokenApi not found in Custom metadata - MuleApiSetting__mdt';
        }

        System.debug('Token: ' + accessToken);

        callStatus = new Status(isSuccess, errorCode, errorMsg);
        result = new Result(callStatus, null, accessToken);

        return result;
    }

    private static Result getOppRecord(String oppId, String accessToken){
        boolean isSuccess = true;
        String errorCode = null;
        String errorMsg = null;
        Status callStatus;
        Deal oppRecord = null;
        Result result;
        MuleApiSetting__mdt apiSettings = MuleApiMetaDataMap.get('OppCategoryApi');

        if(apiSettings != Null && String.isNotEmpty(apiSettings.End_Point_Url__c)){
            string token = accessToken;
            String authorizationHeader1 = 'Bearer ' + token;

            HttpRequest req = new HttpRequest();
            req.setEndpoint(apiSettings.End_Point_Url__c + oppId);
            req.setMethod('GET');            
            req.setHeader('Authorization', authorizationHeader1);
            req.setHeader('Accept', 'application/json');                        
        
            Http http = new Http();
            HTTPResponse res = http.send(req);
            System.debug('Response body::' + res.getBody());

            Integer httpResonseStatusCode = res.getStatusCode();
            if(httpResonseStatusCode == 200){
                String oppresponseBody = res.getBody();
                oppRecord = (Opp) JSON.deserialize(oppresponseBody, Opp.class);                
            }else{                                                                              //Api error
                isSuccess = false;
                errorCode = String.valueOf(httpResonseStatusCode);
                errorMsg = res.getBody();
            }
            
        }else{                                                                                 //Settings data issue error            
            isSuccess = false;
            errorCode = 'API Setting Not Found';
            errorMsg = 'Record - OppCategoryApi not found in Custom metadata - MuleApiSetting__mdt';
        }

        callStatus = new Status(isSuccess, errorCode, errorMsg);
        result = new Result(callStatus, oppRecord, null);

        return result;
    }

    private static void processoppRecord(Id oppRecordSFId, opp apiResponseoppRecord){
        //Delete all existing records
        List<opp_Category_from_RASIM__c> existingoppRecords = [Select Id from opp_Category_from_RASIM__c Where opp__c = :oppRecordSFId];
        if(existingoppRecords != Null && existingoppRecords.size() > 0){
            delete existingoppRecords;
        }

        //Create opp_Category_from_RASIM__c record from Api response record
        List<opp_Category_from_RASIM__c> newoppRecords = new List<opp_Category_from_RASIM__c>();

        for(oppCategory oppCat : apiResponseoppRecord.OPP_CATEGORIES){
            opp_Category_from_RASIM__c oppRecord = new opp_Category_from_RASIM__c();
            oppRecord.opp__c = oppRecordSFId;

            oppRecord.CATEGORY_NAME__c = oppCat.CATEGORY_NAME;
            oppRecord.CATEGORY_DESCRIPTION__c = oppCat.CATEGORY_DESCRIPTION;
            oppRecord.CATEGORY_ID__c = oppCat.CATEGORY_ID;
             
            
            

            newoppRecords.add(oppRecord);        
        }

        if(newoppRecords.size() > 0){
            insert newoppRecords;
        }
    }


    public class Result{  
        @InvocableVariable    
        public boolean isSuccess;

        @InvocableVariable
        public String errorCode;

        @InvocableVariable
        public String errorMessage;           

        public Status status;         
        public opp oppRecord;
        public String accessToken;  

        public Result(Status statusInput, opp oppRecordInput, String accessTokenInput){
            this.status = statusInput;
            this.oppRecord = oppRecordInput;
            this.accessToken = accessTokenInput;

            this.isSuccess = this.status.isSuccess;
            this.errorCode = this.status.errorCode;
            this.errorMessage = this.status.errorMessage;
        }
    }

    global class Status{
        @InvocableVariable
        public boolean isSuccess;

        @InvocableVariable
        public String errorCode;

        @InvocableVariable
        public String errorMessage;

        public Status(boolean isSuccessInput, String errorCodeInput, String errorMessageInput){
            this.isSuccess = isSuccessInput;
            this.errorCode = errorCodeInput;
            this.errorMessage = errorMessageInput;
        }
    }

    public class opp{
        public String OPP_ID;        
        public String OPP_NAME;        
        public oppCategory[] OPP_CATEGORIES;
    }

    public class oppCategory{
        public String CATEGORY_NAME;
        public String CATEGORY_DESCRIPTION;
        public String CATEGORY_ID;
        
     
    }
}






 

I have a self relationship on Account object 

Parent Record: Account 1, RecordType = HQ,   Owner =  'Donald  Duck'

Child Record:  Account 2, RecordType = Franchisee,   Owner  =' Billy Wonka'

Child Record:  Account 3,  RecordType = Franchisee,   Owner  =' Billy Wonka'

So, on Account2 I have a field called Parent that looks up to Account 1

In the Territory Hierarchy I have a Territory called 'SOHO'

User assigned to  'SOHO'  =  Billy Wonka

Account assigned to 'SOHO'  = Account 1

When the User assigned to 'SOHO' changes to 'Mickey Mouse'  I want the owner of the Child Records Account 2 and Account 3 to be changed to  'Mickey Mouse'

So basically chnaging the owner on the child records to be the user who is assined to a territory. 

Is that possible ? 

Here is my psedocode:

Trigger on Territory2  after update
If  IsChanged (Territory2. assinedOwner ) 

GET Id of the  Territory's Assignd Owner 

Find Child Records related to the Id

Add the Child Records in a List

For EachItem in the ChildRecordList  get the ownerid 

childrecordOwnerid = Territory's Assignd OwnerID

 

Is this possible in a trigger or a flow ? 

  

 

 

 

 

 

This is the SOQL used in a trigger
 
List<User> usrlst = [SELECT Id FROM User WHERE UserRole.DeveloperName LIKE : '%Customer_Support_Rep%' and IsActive = True];


Instead of UserRole.DeveloperName i would like to use the UserRoleId = '78hjhajhjhjhj'

Hardcoding id is not a good practice.

I would like to store the RoleId in same place like custom setting or custommetadat type setting.

However i don't know how to access the value from the custom setting or custom metadata setting.

Can someone help or point to an example?

Thanks.

 

Since Custom Metadata Type Settings does not have the option to create Multi Select Field, is creating 7 checkboxes my only option? 

What are we trying to do ?
Schedule reports to users not in our salesforce org.

How we intend to do this ?
Write an Apex Class, that would pick up records from the Custom MetaData Settings. 

What fields do we have in Custom MetaData Settings ? 
ReportId (text), Recipient Email (text), Time of the Week (DataTime), Day Of the Week (???)

I want Day of the Week to be Multi Select , but there is no option to crate Multiselect field in Custom Metadata Types Setting. 

How can I creatively use Check box to make multiple selections. ? 

 

A user merged two Account records. However the attachment was lost in the process. 
I am unable to restore the attachment. 

I tried this in the Workbench    
Select id, Description, name, OwnerId,CreatedDate from Attachment where isDeleted = true ORDER BY CreatedDate DESC

I see three attachments which could potentially be the one I am looking for. However when i click 'View in Salesforce' i get the error 

**Record deleted**

The record you attempted to access has been deleted. The user who deleted this record may be able to recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 15 days.

When i log in as the user and check the Recycle bin I don't see these attachments in the 'My Recycle Bin'  or even the 'Org Recycle Bin'

Any other way to restore Attachments lost from merging Accounts?  
This visualforce page is referenced in Sites inside my Salesforce Org. The site domain is iframed inside the company website.

On form submit, there should only be paragraph text saying "Thank you for Submitting the form, A team member will contact you soon." as a completed action and not redirect to any other page.

This is the code I have, but it redirects to the new page within an iframe, which looks ugly and confusing.  A simple Thanks you message on submit without navigating to a new page is what i am after. 

Can someone please guide. ? 
 
<apex: page ... >
      <paex:form>        
         <apex:commandButton onclick="validation();return false;" value="submit" reRender="frm" />
      <apex:form>
   <apex:page>



Class 

 Public PageReference savelead(){
         if (this.validateRecaptcha() == false) {
             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Please re-enter the RECAPTCHA'));
            return null;
         }else{
            lead.LeadSource = 'Web';
            lead.LastName = lastname;
            lead.Company = company;
            insert lead;
        
            PageReference reRend = new PageReference('https://www.companysite.com/node/111/done?sid=8888&token=8888888880d9c68282306d7af9f8888');
            reRend.setRedirect(true);
            return reRend;
    
          }
       }


 
I have created a site, referenced a visualforce page which is a form and hosted it in an ifrane on the company's website. The form when completed and submitted, creates a lead in Salesforce, and the form is renderedAs a  pdf, and attachment laso gets inserted in salesforce, and related to the lead.  So far so good.  

Here's another use case i am trying to solve - 

There are certain types of leads that are created manually. 
After the lead is created, we email out the form link to the lead. 

How can i ensure that when the lead submits the form, it finds the already created lead record in salesforce, and does not create a duplicate. 

Thanks 

When the lead submits this form, how can the form which is renderedAs pdf be attached to the already created lead. ? 
 

I have created a web to lead form, and want the lead to be assigned to the user with the least number of open leads. 

I am not sure Omni Channel would work for this use case, becuase this is not a service desk.  

I was thinking of creating  custom field on the User object that would keep a count of the number of open leads owned by the User, and then writing  BEFORE (INSERT OR UPDATE) trigger. 
 

Does anyone have a better solution or recommendation ?  
 

I am trying to make the Docusign JS Docusign button available in lightning. JS code of the classic button is similar to this - 

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}

//********* Option Declarations (Do not modify )*********// 
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//

DST = '00xxxxxxxxxxxx000000';
CCRM = 'Internal~Internal;Client~Client';
CCTM = 'Internal~Signer;Client~Signer';
CRL = 'Email~{!User.Email};LastName~{!User.LastName};';
alert(CRL);
CES = 'Test Email Subject';

//********* Page Callout (Do not modify) *********// 
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0 &SourceID={!Lead.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+" &CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+" &DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+" &SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+" &SRS="+SRS+"&SCS="+SCS+"&RES="+RES; 
//*******************************************//


What changes do i have to make in Lightning > Setup > Object > Buttons and Links >  to be able to e execute this button from Lightning? 

User-added image

 

Formula Field : Visited Time 
Return type = TEXT 

User-added image

The output i am seeing is in GMT . How can i get the output in the field Visited_Time__c to be the same as the CreatedDate Time 

In this example, Visited Time =  18:14:49z , Created Time = 2:14 pm 

 

User-added image

I would like the Vistied Time = 2:14 pm 

 

  • September 21, 2020
  • Like
  • 0

Object: Account

RecordType   'Supplier Account'  , 'Lender Account'

I want to establish a m:m relationship between Accounts of different RecordTypes. e.g. 'Supreme Bolts Inc'  (Supplier Account)  can apply for financing to 'National Leasing Company'  (Lender Account), and many other Leasing Companies.  

I want to create a junction object to relate two Accounts of different RecordTypes. However, it seems like this is not possible.

1. Created a new Object,

2. Created a field  Supplier__C with M-D relationship with Account.

2. Created a filed Lender__c but cannot select Account for M-D rellationship. 

I think this use case is common, and wondering how others have tackled this or if someone could offer design ideas I would truly appreciate it. 

 

Thanks!  
 

  • September 14, 2020
  • Like
  • 0

Based on the awesome tutorial  here (https://sfdcmonkey.com/2017/01/02/http-callout-lightning-component/)
I created a lightning component to make a Http Callout  
Now I would  like to measure the  usage of this  Http Callout, similar to the 7 day API usage metrics report. However, i want to know which user clicked the button and how many times in a day/week. 

Can some please point me in the right direction or to a documentation/blog to be able to build a lightning component usage metrics. 

  • September 14, 2020
  • Like
  • 0

I have a couple different upserts built out in Jitterbit that are all supposed to be running everyday. Some of them are working and some of them are not. They are set up to run with the same salesforce user login (whose password is set to Never Expire).

I cannot figure out why some are working and some are not. I scheduled them all at different times throughout the day, so that they don't enter into a race.

If I run the jobs manually they run successfully. 

Can someone offer suggestions or ideas as to what i should be doing to debug?

Thanks. 

  • September 10, 2020
  • Like
  • 0
I know there is an idea out there (https://trailblazer.salesforce.com/ideaView?id=08730000000BqkT)  that is not implemented by salesforce. 

However, can someone give ideas or suggestions as to how they would create 'New Event' from  'Log a call '. 

Here my use case- 
When our sales folks call a customer, based on that call we may need to set a follow up task OR create an event. We would like to save clicks.  It would be nice to do it all in one place instead of first saving the 'log a call' and then clicking 'New Event'  and then saving it.
Currently the 1st Stage in Opportunity is 'Requires Analysis', the business  wants to replace that with Interested'

My question is 
What should i be concerned about before making this change? 
Are there any repurcussions to replacing a stage name from one value other? 
We are evaluating ETL/Middleware to integrate Salesforce with our external database, and the sync should happen in real time. 

Use Case: When an Account gets created in Salesforce, check if the accounts exists in the external database. If it does not exist, create a record in external database. The record gets an autogenerated ExternalID__c. Then, bring the ExternalID__c back to salesforce , and and update the Salesforce record to populate the ExternalID__c field.

If the Account already exists in external database, update the record with the data from salesforce, and then bring the ExternalID__c back to salesforce , and and update the Salesforce record to populate the ExternalID__c field.

My question is  what is the best solution for this use case ? 
I was looking into Jitterbit and Mulesoft. 

What are the Pros and Cons of of using Jitterbit vs Mulesoft for my use case? 

Thanks !
We enabled Coonected Campaign in Pardot, a feature that allows to connect SAlesforce + PArdot Campaigns. 

However, by doing this, our pardot admin, can no longer create campaigns in Pardot. 

What are the repurcussions if we now disable the feature that connects Salesforce + Pardot Campaigns. ?
I am doing this trail head module :
https://trailhead.salesforce.com/content/learn/projects/quickstart-vscode-salesforce/vscode-salesforce-ready?trail_id=force_com_dev_beginner

when trying to install the CLI through the installer, I get the error 
'The requested operation requires elevation'
Why do i see Export option on some reports in lightning and some reports do not have the Export option. ? 

The only reason i can think of is, the reports that have Export option may have been created after feature was delivered in lightning by Salesforce . 

Can someone please verify ? 

Thanks !
 
// I am trying to translate the following pseudo code to Apex -> base64(hmac-sha256({accessKeySecret}, UTF8({stringToSign})))

// My atempt at translating to Apex
String dateString = Datetime.now().formatGmt('EEE, dd MMM yyyy HH:mm:ss Z'); 

String stringtoSign = 'GET\n\n\n'+dateString;

String secretAccessKey = '9PK^:WAvBrl1?jz3^U{7+)){igpCG\"Y;<.3DGy8gX+' +'\'' + '6p{|D2#MwI#It8{+@W?>*'; 

Blob mac = Crypto.generateMac('HMAC-SHA256', blob.valueOf(stringToSign),blob.valueOf(secretAccessKey)); 

String signature = EncodingUtil.base64Encode(mac); system.debug(signature);

This compiles correctly in Dev Console. However how do i ensure that that I have translated in the format as mentioned in the pseudo code. ? 

I have a VFp , which open another VFP as a popup, after the pop is closed, i want the parent page that opened the popup to be refreshed. 

My code/javscript  closes the VFP popup but it doesnt reload the parent page. I have to manually reload the parent page to see the updated record.

Note:  The reason i am using window.open is becuase i want users to have the ability to scroll through the parent window. 

Any suggestions????


**********************************************************************************************************************
VFP1

<script type="text/javascript">
function OpenVfpage(){
window.open('/apex/SendEmailPage?id={!recordId}', '_blank','scrollbars=yes,width=600,height=800,resizable=no,toolbar=0,location=0,menubar=0');
}
</script>

<apex:commandButton value="Send Email" id="email" onclick="javascript:OpenVfpage();"/>

**********************************************************************************************************************


VFP2

<script language="javascript" type="text/javascript">
function closeVFP() {

if("{!$Request.success}" == "true") {
parent.window.close();
window.close();
        
}
</script>

<apex:commandButton id="saveBtn" value="Send" action="{!sendEmail}" onComplete="javascript:closeVFP();"/>


**********************************************************************************************************************
Controller

public PageReference sendEmail(){
// logic to send the email
return new PageReference ('javascript:window.close()');

}
I have a validation rule on a field Status__c.The error message is as follows -

You cannot "manually " change the Status.

In the Visualforce page I am using this field.

When this validation fires, I see the error in the VFP as -


You cannot &quot;manually&quot; change the status.

Is there a way to display the word manually in double quotes ?

Note in my page i have <apex:pagemessages / >

and in my controller

catch(System.DMLException e){
            ApexPages.addMessages(e);
            return null;

Thanks!
In the Documents, I have a public Folder called 'Images' where I have 6 images. How can I avoid hardcoding the file_id and instead get it dynamically.

Object__c obj = new Object__c();

obj.Test__c = '<img alt="comment image" src="/servlet/servlet.FileDownload?file=015n00000004vra" ></img>';

I know I can create custom setting but again that would mean hardcoding the value.

I want to Query the the folder  from Documents and get respective fileid from the folder.

Thanks!
This is the SOQL used in a trigger
 
List<User> usrlst = [SELECT Id FROM User WHERE UserRole.DeveloperName LIKE : '%Customer_Support_Rep%' and IsActive = True];


Instead of UserRole.DeveloperName i would like to use the UserRoleId = '78hjhajhjhjhj'

Hardcoding id is not a good practice.

I would like to store the RoleId in same place like custom setting or custommetadat type setting.

However i don't know how to access the value from the custom setting or custom metadata setting.

Can someone help or point to an example?

Thanks.

 
The requirement is to get the all duplicate contact with firstname,email,Id, duplicate count

I have already tried this method
[SELECT FirstName,LastName,Email, count(Id) tduplicates FROM Contact GROUP BY FirstName,LastName,Email HAVING count(Id)>1]

but it didn't give the Id

please help me out here

Based on the awesome tutorial  here (https://sfdcmonkey.com/2017/01/02/http-callout-lightning-component/)
I created a lightning component to make a Http Callout  
Now I would  like to measure the  usage of this  Http Callout, similar to the 7 day API usage metrics report. However, i want to know which user clicked the button and how many times in a day/week. 

Can some please point me in the right direction or to a documentation/blog to be able to build a lightning component usage metrics. 

  • September 14, 2020
  • Like
  • 0

I have a couple different upserts built out in Jitterbit that are all supposed to be running everyday. Some of them are working and some of them are not. They are set up to run with the same salesforce user login (whose password is set to Never Expire).

I cannot figure out why some are working and some are not. I scheduled them all at different times throughout the day, so that they don't enter into a race.

If I run the jobs manually they run successfully. 

Can someone offer suggestions or ideas as to what i should be doing to debug?

Thanks. 

  • September 10, 2020
  • Like
  • 0
I am trying to let the following validation rule work:
 
AND(
AND($User.vub_Bypass_Validation_Rules__c = false, $Profile.Name = 'Profile A'),
OR(AND(OR(ISCHANGED(CaseOwner), ISCHANGED(ContactName), ISCHANGED(Status), ISCHANGED(Internal Comments)),
))
Unfortunately the syntax is not correct.
What I want is to prevent users with the Profile A (for example) to change/edit the standard fields Case Owner, Contact Name (lookup), Status and Internal Comments.

You can not set such fields as read only on page layout level. Users with this profile should be able to edit when Cases are of Record Type "Claim", but not cases of type "Only Information". So I see the only way is with a validation rule.

I would appreciate any help.
 
Currently the 1st Stage in Opportunity is 'Requires Analysis', the business  wants to replace that with Interested'

My question is 
What should i be concerned about before making this change? 
Are there any repurcussions to replacing a stage name from one value other? 
Hi.
I have a few Old Visual Flows in my org and need to disable (and delete, if its possible) them.
Thanks
I need to override standard Create and Edit Actions on Account object with Lightning Component. Is there a way or a type of field that we could cover the following requirement? Have a field with some predifined values but letting user if he wants to enter free text. I would actually like something like Subject field on Task object but i cannot find any way to implement it. Any ideas please ?
Example: I have a picklist field for Citizenship that has some values for Countries (England, Germany, France, ...etc...). But i want to let user enter his own value (for example: German). i have tried using the following but without success:
 
<!--05/09/2019 George Galaios: Code for Iteration Picklist: Citizenship -->
                        <lightning:select aura:id="accCitizenship" label="{!$Label.c.ea_citizenship}" value="{!v.accountRecord.ea_Citizenship__c}" disabled="{!and(v.noExtraPermission, v.noPermAndCleansed)}" class="slds-size--1-of-2 slds-p-horizontal_x-small">
                            <aura:iteration items="{!v.ea_Citizenship_Values}" var="item">
                                <option value="{!item}" selected="{!item==v.accountRecord.ea_Citizenship__c}">{!item}</option>
                            </aura:iteration>
                        </lightning:select>                
                        <!-- End of Code for Iteration -->

 
Why do i see Export option on some reports in lightning and some reports do not have the Export option. ? 

The only reason i can think of is, the reports that have Export option may have been created after feature was delivered in lightning by Salesforce . 

Can someone please verify ? 

Thanks !
 
Hello,

I'm a novice at Apex code and am trying to adjust my extension for SavePDF so that it saves as a file as well.  I get an error message related to the line that says:  file.Origin = 'a';

I am indicating the wrong origin or something?  Or do I need to complete the attachment fully before I can add the file?  Any help would be appreciated!

 
public pageReference savePDF(){
    
        Date dateToday = Date.today();
        String sMonth = String.valueof(dateToday.month());
        String sDay = String.valueof(dateToday.day());
        if(sMonth.length()==1){
          sMonth = '0' + sMonth;
        }
        if(sDay.length()==1){
          sDay = '0' + sDay;
        }
        String sToday = String.valueof(dateToday.year())+ '-' + sMonth +  '-' + sDay ;
        
      PageReference pagePdf = new PageReference('/apex/SalesAgreement_PDF');
          pagePdf.getParameters().put('id', idVal);
          Blob pdfPageBlob;
          pdfPageBlob = pagePdf.getContentAsPDF();
                 
          Attachment a = new Attachment();
          a.Body = pdfPageBlob;
          a.ParentID = idVal;
          a.Name = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
          a.Description = 'Service Agreement_' + sToday;
          insert a;

          ContentVersion file = new ContentVersion();
		  file.Title = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
		  file.PathOnClient = 'Service_Agreement_' + Datetime.now().getTime() + '.txt';
		  file.VersionData = Blob.valueOf('Service_Agreement_' + 
		  Datetime.now().getTime() + '.txt');
		  file.Origin = 'a';
		  insert file;         
    
        
        pop_msg='Successfully saved';
        displayPopup = true;  
       
        
        opp.Signature_Date__c = null;
        opp.Signature_Key__c = '';
        opp.Signature_Name__c = '';
        opp.Signature_URL__c = null;
        opp.Signature__c = null;

        
        update opp;
      return new PageReference('/apex/SalesAgreement_HTML?id=' + idVal);
      
        
    }



 
Hi Team,


I am sorry if my question is stupid, but I tried to use Lightning Starter and create a trial account, I did not receive any notifications on email and cannot change password, SF informs me that the old password incorrect. If I try to change it, SF asks me a secret question, Could you please help me?
// I am trying to translate the following pseudo code to Apex -> base64(hmac-sha256({accessKeySecret}, UTF8({stringToSign})))

// My atempt at translating to Apex
String dateString = Datetime.now().formatGmt('EEE, dd MMM yyyy HH:mm:ss Z'); 

String stringtoSign = 'GET\n\n\n'+dateString;

String secretAccessKey = '9PK^:WAvBrl1?jz3^U{7+)){igpCG\"Y;<.3DGy8gX+' +'\'' + '6p{|D2#MwI#It8{+@W?>*'; 

Blob mac = Crypto.generateMac('HMAC-SHA256', blob.valueOf(stringToSign),blob.valueOf(secretAccessKey)); 

String signature = EncodingUtil.base64Encode(mac); system.debug(signature);

This compiles correctly in Dev Console. However how do i ensure that that I have translated in the format as mentioned in the pseudo code. ? 
Hello Gurus,
I had a trigger(generates an email on department name change) and a test class related to this trigger.  The coverage was 100%. I changed the trigger to fire only when the profile is <> System Administrator.  The trigger is working fine as expected but the Test class is failing.  Here is the trigger code and followed by Test class code.
--------------------------------------------------------------
trigger SendEmailAfterDeptCodeUpdate on Department__c (after update) {
Profile p = [ Select Id, Name from Profile where Id =: UserInfo.getProfileId() ];
        if( !p.Name.equalsIgnoreCase( 'System Administrator' ) ) 
        {
  List<Id> lstdeptsToUpdate=new List<Id>(); 
for(Department__c dept : trigger.new)
{
    If (dept.Name !=trigger.oldMap.get(dept.Id).Name)
    {
    lstdeptsToUpdate.add(dept.Id);
    }
}
    
    If(lstdeptsToUpdate.size()>0)
    {
    Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment();
    
   // string header = '*TR Customer Code, *Customer Name,*TR Department ID,*Original Department Code,*New Department Code,*SubBranchCode,TR Customer Id \n';
 string header = 'SubBranchCode,TRCustomerId,TRDepartmentID,OriginalDepartmentCode,NewDepartmentCode,TRCustomerCode \n';

    string finalstr = header ;
    String Emailbody;
        
    
    string csvname= 'template_to_update_WO_inv_dept.txt';
    csvAttc.setFileName(csvname);
    
    system.debug('header:' + header);
     String messageBody,priorvalue;   
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    //email.setSubject('Department Code change in Salesforce');     
   for (Department__c dep1 : [Select id, Name,Service_Entity__r.Customer_Name__c,TR_Customer_Code__c,trDepartmentID__c,Service_Entity__r.Sub_Branch__c,Service_Entity__r.Sub_Branch__r.Sub_Branch_Code__c,Service_Entity__r.TR_Customer_Id__c from Department__c where id in : lstdeptsToUpdate and Service_Entity__r.Send_To_TR__c=True])
        {
     priorvalue=trigger.oldMap.get(dep1.Id).Name; 
     //string recordString = dep1.TR_Customer_Code__c + ','+ dep1.Service_Entity__r.Customer_Name__c+','+dep1.trDepartmentID__c +','+priorvalue+','+dep1.Name+','+dep1.Service_Entity__r.Sub_Branch__r.Sub_Branch_Code__c +','+dep1.Service_Entity__r.TR_Customer_Id__c +'\n';
     string recordString = dep1.Service_Entity__r.Sub_Branch__r.Sub_Branch_Code__c+','+dep1.Service_Entity__r.TR_Customer_Id__c+','+dep1.trDepartmentID__c +','+priorvalue+','+dep1.Name +','+ dep1.TR_Customer_Code__c  +'\n';

          finalstr = finalstr +recordString;
      
         messageBody = '<html><body>';
         messageBody = messageBody + 'Here are the details for the change in Department Code in Salesforce ';
         messageBody = messageBody + '<br>';
         messageBody = messageBody + '<br>';            
         messageBody = messageBody + 'TR Customer Code: '+ dep1.TR_Customer_Code__c;
         messageBody = messageBody + '<br>';
         messageBody = messageBody + 'TR Department ID: ' + dep1.trDepartmentID__c;
         messageBody = messageBody + '<br>';
               
         messageBody = messageBody + 'Original Department Code: ' + priorvalue;
         messageBody = messageBody + '<br>';
         messageBody = messageBody + 'New Department Code: ' + dep1.Name;
         messageBody = messageBody + '<br>';
         messageBody = messageBody + '<br>';            
         messageBody = messageBody + 'Additional details are available in the attached excel. Please update the Work Order and Invoicing details with the new department code.';
         messageBody = messageBody + '<br>';
         messageBody = messageBody + '<br>';            
         messageBody = messageBody + 'Assign ticket to - Data Management Backend group';
    
         messageBody = messageBody + '</body></html>';       
    
    blob csvBlob = Blob.valueOf(finalstr);    
    csvAttc.setBody(csvBlob);

    system.debug('----');    
    email.setSubject('Department Code change in Salesforce updated to ' + dep1.Name ); 
    email.setHtmlBody(messageBody);

    email.setToAddresses(new String[]{'raos@gmail.com'});
    email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc});
    system.debug('email...' + email );
    if(email != null)
      {
       Messaging.sendEmail(new Messaging.singleEmailMessage[] {email}); 
       //   system.debug('Inside send email');
      } 
    }        
}
        }
}
--------------------------------------------------------------
@IsTest
public class SendEmailAfterDeptCodeUpdateTest {
static testMethod void SendEmailAfterDeptCodeUpdateTest()
    {
        Profile p = [ Select Id, Name from Profile where name='System Administrator' limit 1 ];
        //Profile p = [ Select Id, Name from Profile where name='Standard Sales User' limit 1 ];
        User standardSales = new User(profileId = p.id, username ='standarduserAdmin@peak.com', email = 'standarduser123@peak.com', 
                                     emailencodingkey = 'UTF-8', localesidkey ='en_US', languagelocalekey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                    alias='nuser123', lastname='lastname123');
        insert standardSales;
        system.runAs(standardSales)
        {   /*Account a=new Account(Name='Test1',BillingCountry='United States',BillingState='Indiana');
            insert a;
         
            Acquisition__c ac= new Acquisition__c(Name='Test Ac');
            insert ac;
         
            Service_Entity__c Se1=new Service_Entity__c(Customer_Name__c='Testa',Legal_Entity__c='Archive Systems Inc.',Account__c=a.id,AcquisitionDB__c=ac.id);
            insert Se1;*/
            
            Department__c dept1= new Department__c(Name='Test Dept',Department_Name__c='Sample Dept',  CurrencyIsoCode='USD',Service_Entity__c='a0t1W00000Un1kR'); //Se1.Id);
            test.startTest();
            insert dept1;
            test.stopTest();
        }


    }
    static testMethod void updateDepartmentTest1(){
                
        Profile p2 = [ Select Id, Name from Profile where name='Onboarding Team' limit 1 ];
        User standardSales2 = new User(profileId = p2.id, username ='standarduserAdmin123@peak.com', email = 'standarduseranc@peak.com', 
                                     emailencodingkey = 'UTF-8', localesidkey ='en_US', languagelocalekey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                    alias='nuser123', lastname='lastname1231');
        insert standardSales2;

       system.runAs(standardSales2)
        {   Department__c dept11= new Department__c(Name='Test Dept123',Department_Name__c='Sample Dept123',  CurrencyIsoCode='USD',Service_Entity__c='a0t1W00000Un1qH'); //Se1.Id);
            insert dept11  ;   
            test.startTest();
            dept11.Name='Test Dept1243';
            Update dept11;
            test.stopTest();
        }   
    }
    static testMethod void updateDepartmentTest(){
        Profile p = [ Select Id, Name from Profile where name='System Administrator' limit 1 ];
        User standardSales = new User(profileId = p.id, username ='standarduserAdmin@peak.com', email = 'standarduser123@peak.com', 
                                     emailencodingkey = 'UTF-8', localesidkey ='en_US', languagelocalekey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                    alias='nuser123', lastname='lastname123');
        insert standardSales;
        system.runAs(standardSales){
            Department__c dept2= new Department__c(Name='Test Dept2',Department_Name__c='Sample Dept2',  CurrencyIsoCode='USD',Service_Entity__c='a0t1W00000Un4UM'); //Se1.Id);
            insert dept2;
            
            test.startTest();
            dept2.Name='Test Dept3';
            Update dept2;
            test.stopTest();
        }
    }
}
--------------------------------------------------------------

I am getting the following error message

System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Stack trace is showing this message:
Class.SendEmailAfterDeptCodeUpdateTest.updateDepartmentTest1: line 39, column 1

I have highlighted the line 39.  The new method that i have include is updateDepartmentTest1().

Let me know the mistake I am doing.

Thanks
Rao
  • May 21, 2019
  • Like
  • 0
I am looking for an integration specialist who can guide me . ? 

I need help with code review for generating HMAC signature . 

 

We have a custom EmailService for inbound messages written in apex, which is processing Inbound email messages and then showing them in a lightning component.
The type od the received email object is EmailMessage. On the production org, when the system administrator is logged in, he sees all the needed incoming emails (the component is showing them as it should be, querying also works). It all worked well in our sandbox though.
The problem is when the user is logged in. The component does not show any emails and they are not visible also by querying. The problem is I suppose with some permissions, but the EmailMessage object in our org is not customizable when it comes to permissions (everything is set to default and is not changeable). The user has a company community licence. Any help or suggestion would be greatly appreciated.
Hello Team,

Below is a requirement from one of our customers.

The objective is to have a parallel approval process on an object.
For Example, when a record is submitted for approval, it has to spawn multiple approval steps(more than 2) in Parallel (say, Approval from Legal team, approval from Finance team). Either of these steps can be approved/rejected in parallel by different sets of approvers.

We can find parallel approvers for a single approval step but not parallel approval steps in the configuration. Can anybody please guide here how to achieve this parallel approval steps?