function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Francis WanFrancis Wan 

modify a field's value with its' own value

I have a nightly upload to salesforce which maps a string from my database to a custom field in sfdc using jitterbit. 
What I want to do is append the string that is already in sfdc to the new string that is coming in from the nightly upload and build up the string.
Basically we have account notes in my db that need to be added to a text area to sfdc without having to re upload the entire account notes table.
So for example, the text area shows:
Dec 10, 2017 called customer
Dec 9, 2017 payment made 
....

After the nightly upload it would show:
Dec 11, 2017 account closed
Dec 10, 2017 called customer
Dec 9, 2017 payment made
...

The upload would only have the string "Dec 11, 2017 account closed" and that would be appended the string
Dec 10, 2017 called customer
Dec 9, 2017 payment made


It would be simple if i can modify the value with itself but that can't be done in a formula, i.e.
newString = "Dec 11, 2017 account closed<br/>"
currentString = "Dec 10, 2017 called customer<br/>Dec 9, 2017 payment made"
currentString = newString + currentString 

I was thinking of a bunch of placeholder fields to hold intermediate values however I can't seen to figure out the logic to do this. 
I was thinking maybe to do something like this (each variable is a custom field)
newString //coming in from the db upload
currentString = newString  + oldString // formula field to show in the text area the newString appended with the string already in sfdc
oldString = currentString // formula field to hold the current string 

Are there any potential issues here?  Any experienced admin/developers that can provide any comments or how they would approach this issue?
I am pretty new to sfdc so I have not had any experience with workflow rules. Would that be a more proper way to tackle this issue? If so how would that be implemented?

Thanks in advance.





 
Best Answer chosen by Francis Wan
jigarshahjigarshah
Francis,

I presume the process of updating Notes within the respective Salesforce fields would be initiated thorugh Jitterbit or an entity external to Salesforce. Couple of points that you may need to consider while doing this.
  1. There is a limit on the total number of API calls that are made to REST endpoints within Salesforce irrepective you doing it from custom code or through a middleware like Jitterbit. Hence refer the following article - https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_api.htm to understand the limitations and work around it.
  2. I see that there are 2 processes here - a. Sending the information to Salesforce b. Updating the notes by appendind content. You may want to consider the volume of data that is being sent and updated and may want to consider using a Bulk API provided by Salesforce in case the transactions are data heavy.
  3. You may also want to consider the Total heapsize limit for 6 MB of synchronous processing and 12 MB for asynchronous processing while performing this activity. Heap size is the size allocated while on the heap data structure while processing the requested information. Larger the payload to be processed, higher are the chances of hitting heapsize limits.
  4. Additionally, you need to consider the CPU Timeout limit which is 10 sec and 60 sec for synchronous and asynchronous transactions respectively. More processing requirements higher are the chances of being close to hitting the CPU timeout threhold.
I would recommend separating the processes where the Jitterbit Job only writes the notes, to a temporary staging field or object within Salesforce. Have another process using a Workflow, Process Builder or Trigger that then updates actual fields asynchronously.

Hope that helps.

Please mark the thread as SOLVED and answer as the BEST ANSWER if it helps adress your issue.

All Answers

jigarshahjigarshah
Francis,

I presume the process of updating Notes within the respective Salesforce fields would be initiated thorugh Jitterbit or an entity external to Salesforce. Couple of points that you may need to consider while doing this.
  1. There is a limit on the total number of API calls that are made to REST endpoints within Salesforce irrepective you doing it from custom code or through a middleware like Jitterbit. Hence refer the following article - https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_api.htm to understand the limitations and work around it.
  2. I see that there are 2 processes here - a. Sending the information to Salesforce b. Updating the notes by appendind content. You may want to consider the volume of data that is being sent and updated and may want to consider using a Bulk API provided by Salesforce in case the transactions are data heavy.
  3. You may also want to consider the Total heapsize limit for 6 MB of synchronous processing and 12 MB for asynchronous processing while performing this activity. Heap size is the size allocated while on the heap data structure while processing the requested information. Larger the payload to be processed, higher are the chances of hitting heapsize limits.
  4. Additionally, you need to consider the CPU Timeout limit which is 10 sec and 60 sec for synchronous and asynchronous transactions respectively. More processing requirements higher are the chances of being close to hitting the CPU timeout threhold.
I would recommend separating the processes where the Jitterbit Job only writes the notes, to a temporary staging field or object within Salesforce. Have another process using a Workflow, Process Builder or Trigger that then updates actual fields asynchronously.

Hope that helps.

Please mark the thread as SOLVED and answer as the BEST ANSWER if it helps adress your issue.
This was selected as the best answer
RKSalesforceRKSalesforce
Hi Francis,

I think you can acheieve it by 2 Ways:
1)  By using workflow tule field update
User-added image
create a field update like above. 
2)  By Writing trigger on your Note Object
Trigger on Notes Objects before insert.
Logic: 
Trigger updateNotes on Account_Notes__c(before update){
	for(Account_Notes__c not: Trigger.New){
		not.Notes__c = not.Notes__c + </br> + Trigger.oldMap.get(not.Id).Notes__c;
	}
}

Please let me know if helped.

Regards,
Ramakant
Francis WanFrancis Wan
Thanks for the help guys. I got it working using the process builder to append the old string to new string based on if the incoming string field has changed. If for some reason, my uploaded string is duplicated (which it never should since it includes timestamps), it should not effect what the user is seeing in the presented field in the layout.