INTRODUCTION
When working on any object in Salesforce and with records we want to edit we can do it however when another user is also editing the same record at the same time in same Salesforce org then both users will have the previous save details to edit. Here is the detail of the problem, the user who saves the record first will change the details then the other user editing the same record is still editing the previously saved record. This causes issues when the second user doesn’t know the first record has changes and they are just about to change an old record.
As a Salesforce Consultant I have had the QA team reject a piece of functionality due to changes to multiple changes to the same Salesforce object where I am either first, second or even the third user to make the changes to the same object. Girikon’s Salesforce Consulting services team is made up of hundreds of Salesforce consultants and as many as 10+ could be working on the same project at one time which sometimes makes it difficult for all consultants to know which objects the other consultants are editing.
THE SOLUTION IS EASIER THAN YOU THINK…
Now let’s think about the solution. We could lock the record for other users. This is a great feature so that second and third users must refresh in order to get the new details.
Whenever two or more users open the Salesforce object record to edit then the user who triggers the first save event has priority and will be able to save the record. When the second user saves the changes then user will get locked and the record will not get saved. To remove the lock, the second user will need to refresh and re-open the editing Window for that particular record. Now the user will be presented the new details which were saved by the first user. I have developed a practical guide below to assist with eliminating the problem.
FOLLOW THE STEP BY STEP SOLUTION BELOW…
First, the records of the object (that you want to edit) should be displayed on the screen through visual force page or lightning.
Now select a record whose details you want to edit .
If two or more users are editing the same record at the same time, then the user who will click on the save button on priority will only be able to save the record.
If other users click on the save button the they will get directed to a new page which will show the message to refresh the page.
For creating this you must add the below mentioned Visual Force code in your VF page.
<apex:page controller="lockingMachenismForAnyObject" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection>
<apex:inputText value="{!searchName}" label="ENTER THE NAME TO EDIT"/>
</apex:pageBlockSection>
<apex:commandButton value="search" action="{!search}">
</apex:commandButton>
<apex:pageBlockTable value="{!ReturningList}" var="v">
<apex:column headerValue="USER NAME" title="NAME">
<apex:outputField value="{!v.name}"/>
</apex:column
<apex:column headerValue="USER PHONE NUMBER" title="PHONE NO">
<apex:outputField value="{!v.phone}"/>
</apex:column
< apex:column headerValue="USER FAX NUMBER" title="FAX NO">
<apex:outputField value="{!v.fax}"/>
< /apex:column>
< apex:column headerValue="USER ID" title="ID">
< apex:outputField value="{!v.id}" />
</apex:column>
<apex:inlineEditSupport event="ondblClick">
< showOnEdit="saveButton,cancelButton"/>
</apex:pageBlockTable>
<apex:pageBlockButtons>
<apex:commandButton value="Save" action="{!save}" id="saveButton"/>
< apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton"/>
</apex:pageBlockButtons>
< apex:pageBlockSection >
<apex:inputText value="{!newName}" label="Enter New NAME"/>
</apex:pageBlockSection>
<apex:pageBlockSection>
<apex:inputText value="{!newPhone}" label="Enter New PHONE"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
< apex:inputText value="{!newFax}" label="Enter New FAX"/>
</apex:pageBlockSectio >
< /apex:pageBlock>
</apex:form>
For the above VF code below one is the apex code.
public without sharing class lockingMachenismForAnyObject
{
//Describing all the variables.
public string searchName{get;set;}
public string idOfSearchedName{get;set;}
public string newName{get;set;}
public string newPhone{get;set;}
public string newFax{get;set;}
// Fetching the list of Account records.
public List ob= new List([select name,phone,fax, id from account ]);
//initialising Method.
public list getReturningList() {
return ob;
}
//initialising Method.
public void search()
{
//Modifying the above list according to the name of the record which we want to edit.
ob= new List([select id,name,phone,fax from account where name = : searchName limit 1]);
idOfSearchedName = ob[0].id;
Account[] accountObject = [SELECT Id FROM Account where name = : searchName];
//Checking the locking condition.
if(Approval.isLocked(accountObject[0].id))
{
Approval.unLock(accountObject);
}
}
//initialising Method.
public pageReference save()
{
if(Approval.isLocked(idOfSearchedName))
{
//Sending the user to the locked page if the locking condition is satisfied.
pageReference pr=Name of the connected page to display.
return pr;
}
else
{
//Else saving the record and locking the same record for the other user.
List ob=new List();
Account updateObject=[select id,name,phone,fax from account where id = : idOfSearchedName];
updateObject.name=newName;
updateObject.phone=newPhone;
updateObject.fax=newFax;
ob.add(updateObject);
update ob;
Account[] accountObject = [SELECT Id FROM Account where name = : searchName];
Approval.lock(accountObject);
return null;
}
}
//initialising Method.
public pageReference cancel()
{
pageReference pr=page.pramodSirVF2;
return pr;
}
}
About Girikon
Girikon is a Salesforce consulting company,development team are based in the USA, in Noida, India and offices in Australia. Girikon’s global team in the USA, India and Australia, allows Girikon to respond at Lightning speed to customers across the globe and is known for its effective delivering and quality service. Girikon is made up of a team of certified Salesforce Consultants with experienced Project Managers, Business Analysts, Salesforce Architects, IT Developers, Consultants, and Administrators.
Girikon’s team of dynamic professionals are experienced in IT across many industries and business, their specialities include software development which includes design, QA testing (Manual and Automated, Support and Maintenance and have many resource model options. Our vision is to develop scalable and simplified solutions for our customers.
Json parsing using Workbench
-
April 30, 2019
-
Sourabh Goyal
Parsing JSON data from Workbench
Why do we always start a question with“why”? The first question that comes to our mind is “Why we are using Workbench for JSON parsing?”
As a Salesforce Consultant I would also follow up similarly with a few other questions such as “Is it the simplest method of Parsing JSON data?”, and “are there other ways in which we can parse JSON data in workbench”. Over the last 4 years with Girikon in the Salesforce Consulting Services team I will try and answer the questions above through an understanding of the given methods below:
METHOD 1: JSON PARSING THROUGH WORKBENCH VIA SERVER
The JSON file is developed as separate code and therefore the most efficient way to check the dynamic project is through the Workbench JSON data parsing method which will benefit the developer by bypassing the rest of the code meaning there is no chance of changing existing code and messing it up. Using Workbench JSON data parsing method also provides the additional benefits such as time saving which translates to increased efficiencies, less complexity and reduced vulnerability to the written code.
Follow the below steps for using Rest Method through workbench:
1. Before you start it is important to set up an account in Workbench.
https://workbench.developerforce.com/login.php?startUrl=%2Fquery.php.At this point login with your Salesforce account.
2. Go to Utilities -> and select Rest Explorer
3. Select the Http Method as POST.
4. Create an Apex class, for mapping the data to be Posted.
5. Set the URL according to Mapping URL and Method
6. Provide the JSON Data in Request body.
And, check the content type from headers.
OUTPUT from the Rest Method will be as follows:
and a new account record will be created in Account sObject .
METHOD 2: JSON DATA PARSING THROUGH WORKBENCH TO SOBJECTS
1. Go to workbench -> Rest Explorer -> HTTP Method POST
2. Now, set the path of the sObject you want as we have used sObject Account to Parse the JSON data.
3. Provide the JSON Data in Request body.
For example:
This will create an account sObject in your Org.
OUTPUT:
and a new account record will be created in Account sObject.
About Girikon
Girikon is a Salesforce consulting company,based out of Phoenix, Arizona with development centre in Noida, India and offices in Melbourne, Australia. Girikon’s global network of offices in USA, India and Australia, allows Girikon to quickly respond to customer’s requirements with a view to effectively delivering a quality product and service. Girikon has a team of experienced and certified Salesforce Consultants including Architects, Developers, Consultants, and Administrators.
Girikon’s team of dynamic, seasoned and qualified professionals have a vast experience in IT across various business areas, Software/ Product development, design, testing, maintenance and resourcing / staffing options. We believe in developing scalable & simplified solution for our clients.
Google Analytics 360 & Salesforce Marketing Cloud Integration
INCORPORATING SCIENCE OF SELLING.
Finally, Analytics from website & data generated from campaigns in Salesforce via Emails, Text & Social channels collaborated seamlessly and bridging the gap of Marketing & Sales through GA 360 suite integration with Salesforce Marketing Cloud.
Helping you invest in the right campaign
As a member of CXO team in any enterprise, it is always a pressure situation for the CXO’s to justify their investment on a particular campaign. Most enterprises use Google Analytics 360 suite (GA 360) to track marketing campaigns and Salesforce to track their Sales operations. As a CXO you know how much each campaign is costing you but you have no idea of which campaign or advertisement is generating the maximum revenue. At times you continue investing in channels which don’t give a great % return.
With GA connector within your IT landscape provides you the capability to:
Know which campaign is profitable
Know which is draining your time & money
Increase profit without increasing spend
With my recent B2B implementation, we identified multiple channels through which a client is made aware about the products & services – these are Social Media, Emails, Paid & Organic searches, Telemarketing, display advertising and not limited to physical direct mails.
Measure your campaigns ROI
A typical B2B conversion cycle is somewhere around 3-9 months, the customer uses various marketing touch points through the journey before it gets converted. To analyze how each of the channels impact conversions, most of the enterprises use the last interaction attribution model which means giving the full credit to the last touch point before the conversion. That means the contribution of all the other touch points is neglected & the money spent on those touch points are considered wasted. The reason why enterprises consider last click or first click attribution model is because they think it’s difficult to bring all of the data in one place. There are many other attribution models which we will cover in detail in our subsequent articles.
Getting the most from the Integration
Providing marketeers an enhance customer experience by personalizing their experiences on their Website, advertisements & their email channels.
Until now marketeers find it difficult to understand & decide what should be the next best interaction with their customers. With Marketing Cloud, we can create journeys through which emails are sent out to a specific audience based on attribution created in GA 360 using leads & opportunity data received from Sales Cloud. When a user reads the email & actions on the email they land on a website page.
Emails also carry journey campaign information as parameters which are then passed on to Google Analytics to analyze & determine the
traffic source & which channel is generating most of the revenue.
With Salesforce Marketing Cloud integrated with GA 360 suite, marketers will have a new set of metrics which will help them to take appropriate decisions for investing into right campaigns & channels.
Prerequisites – As an enterprise you will require Google Analytics 360 & Salesforce Marketing Cloud. Since the Journey
Builder is dependent on the edition you hold, you might need to add this product at an extra cost. You can contact your Salesforce support representative to discuss the pricing involved in enabling GA 360 & Salesforce integration for your enterprise. Enterprises can now view all the interactions & its impact in a single view on Marketing Cloud analytics dashboard.
“Salesforce is thrilled to partner with Google to work hand-in-hand to integrate Salesforce Marketing Cloud with @googleanalytics 360. This is the best of both worlds! https://t.co/YsGbJsfK0. MARC BENIOFF (@BENIOFF) MAY 21″
“Whether your enterprise is large or small, you need to market your products in an efficient way. Do not loose out to your competitors by investing in a channel that is not reaping the fruits of your investment. This integration will help you get the value for each dollar you spend on your marketing campaigns and bridge the gap between the marketing & sales team. As a Salesforce Marketing Cloud Partner and with our experienced Salesforce Marketing Cloud Consultants, Girikon will ensure your strategy is always in line with your business objectives.”
Girikon is an IT consulting and development company, based out of Phoenix, Arizona with development centre in Noida, India and offices in Melbourne, Australia.
Our Global network of offices in USA, India and Australia, allows Girikon to quickly respond to customer’s requirements with a view to effectively delivering a quality product and service. Girikon has a team of experienced and certified consultants Salesforce Architects, Developers, Consultants, and Administrators. Our MEAN Stack, Atlassian APP, Microsoft Dynamics CRM, Mobile APPs, JAVA, PHP, ASP, .NET and AI consultants and professionals also provide services which are second to none.
Our customers and services are many and varied from Fortune 500 companies implementing large E-Business programs to small-medium enterprises implementing Billing Systems.
Specialties – Salesforce.com, Cloud Services, Node.js, Mobile Apps, Atlassian, Custom Software Development, Big Data Analysis, DevOps Automation, SaaS Implementation & Integration, Quality Engineering, Program management & PMO, E-commerce, Salesforce Consulting, Salesforce Implementation, Salesforce Development, Salesforce Integration, Salesforce Migration, Salesforce Consulting Partner, Salesforce Consultants, and Force.com
Girikon’s team of dynamic, seasoned and qualified professionals have a vast experience in IT across various business areas, Software/ Product development, design, testing, maintenance and resourcing / staffing options.
We believe in developing scalable & simplified solution for our clients.
In order to ensure your strategy aligns with your business goals – contact us at sales@girikon.com