A blog about Salesforce CRM Configuration and development

Sunday, 26 May 2019

OWD "Public Read Only" | Only record owner can edit their own records?

Scenario: There is a custom object, it's record should be visible to everyone (users) but only record owner can edit the record. When someone edits a picklist field, the record should be automatically assigned to the groups of the user to work on and they can edit the record and the previously assigned user should not edit the record.


Solution: Below is the steps to set up the things for the above requirement.
  • OWD: for this custom object will be "Public Read Only". (All user can see the record who has object access permission) 

  • OWD ( Organization Wide Sharing Default): It defines the default access level for an object’s records. The organization-wide sharing settings can be set to Private, Public Read Only, or Public Read/Write. 
  • Profile: The users who are going to see and work on the record should have 'Read','Edit' permission on the object.
  • Create queues for different users. (Setup -> Queue-> New)

  • Queue1 : Assigned User( User 1, User 2 )
    Queque 2: Assigned User ( User 3, User 4 )

  • Create a Process Builder: Assigned the record to the queue based on the selected picklist.
Setup -> Process Builder -> New
















Result: When the user changes the 'Level' picklist field value automatically record will be assigned to 'Queue' ( multiple users) with the help of Process Builder.

The record will be read-only to the users and only owner and the user who created the record will be able to edit the record.

Thanks.

Arun Kumar

Share:

Monday, 6 May 2019

Retrieve CustomField Metadata Information Using Tooling API

Sometimes Salesforce admin/user needs to know which custom fields created in a certain time frame like THIS Week/Month/Year, etc.

We can use Salesforce Tooling API to get the CustomField information. We can query the CustomField metadata information inside Salesforce developer console, you just need to check the "Use Tooling API" checkbox. Below is the screenshot showing the lists of custom fields created this year. 

Query: SELECT DeveloperName,CreatedDate,TableEnumOrId FROM CustomField where CreatedDate = THIS_YEAR



Q. How to export the data showing in dev console in CSV format?

Ans~ We can use the 'SDFC Dev Console Data Exporter' google chrome extension for that.

SFDC Dev Console Data Exporter (Screenshot)

Q. What is the Tooling API?

Ans~ Tooling API exposes metadata information of Org, we can access Metadata information using REST or SOAP. Tooling API retrieve the small piece of metadata, we can use this to develop an interactive application or tools for developers.

We can accomplish the following tasks using the Tooling API:
  • Retrieve metadata about an object’s field.
  • Retrieve metadata of custom and standard object properties.
  • Get metadata information about Apex Classes, Visualforce Pages, Apex Triggers.
  • Get Code coverage details of Apex classes and Trigger.
  • Retrieve metadata information about ValidationRule and WorkflowRules.
  • Query RecentItems used in your SFDC org.
  • Etc...
Share:

Sunday, 5 May 2019

Mailchimp Batch Operation | Salesforce - Mailchimp Integration | Mailchimp REST API










MailChimp Batch Operation: We can use this batch operation in the MailChimp API to complete more than one operation in just a single call. Let's take an example where you need to subscribe and unsubscribe the records. In the simple API call, you have to do separate call to make the single record to subscribe and unsubscribe in the MailChimp list this may exceed your API call out limit. The batch operation runs in the background on the MailChimp server and does the more than one action in just a single API call. After callout, we can check the batch status.



Scenario: There is a field on Contact records 'Email Opt Out', whenever user update the field to uncheck subscribe the record in the MailChimp list and vice versa.

MCSubscribeUnsubscribeTrg
MCSubscribeUnsubscribeHelper


Find the code on Github here

Happy Coding...

Reference:
https://developer.mailchimp.com/documentation/mailchimp/reference/batches/
https://developer.mailchimp.com/
Share:

Saturday, 4 May 2019

Edit Action On Account [Contacts] Related List In Lightning Experience



On the Account page, we have the 'Edit' action on the related Contact list in Salesforce classic user interface as shown in the screenshot below.


But if you see the same in the Lightning experience user interface, the user first needs to click on the 'down' button icon then they can see the 'Edit' action option and from there they can click on 'Edit' action.


In the Lightning user interface, the user needs to do an extra click to do the same as they were doing in a single click in Salesforce classic user interface.

I have solved the issue with a workaround (a field and URL hack) in one of my projects.

Create a formula field on Contact object with return type as Text.

Formula:

HYPERLINK(
"https://[custom domain].my.salesforce.com/" & Id & "/e?retURL=https://[custom domain].lightning.force.com/lightning/r/"
& AccountId & "/related/AccountContactRelations/view?0.source=alohaHeader" ,"Edit")


Add the created field in the Account (Contact Related list) page layout.


Result:




Share:

Wednesday, 1 May 2019

Copy To Clipboard | Lightning Component | Copy sObject Record Link


Hello Guys,

In this blog post, I am going to share the 'Copy To Clipboard' functionality in the lightning component using javascript. While working with the records in Salesforce sometimes user needs the record link to share in an email or need to use in the documentation or somewhere else.


This component will copy the record link in the clipboard in just a single click, the user does not need to copy the record link from browser URL. The component can be used for every standard and custom object, the user just needs to add the component on the object detail page and needs to click on the link button icon, the record link will be copied in the clipboard.

Find the full component code below.

copyToClipboardCmp
copyToClipboardCmpController copyToClipboardCmpHelper copyToClipboardCntrl

Full code on GITHUB.
Happy Coding...! 
Share:
Trailhead Profile


Follow by Email

Total Pageviews

Followers

Popular Posts

Powered by Blogger.

Contact form

Name

Email *

Message *