You need to sign in to do that
Don't have an account?
Ross Hopkins 8
Extract text from text field containing multiple "key:<value>" pairs
Hi!
I have a field against the Product object, Tags, which contains data such as the following, imported from a thrid-party system:
As an example based on the above, one of the formulas would search for "location:" and store "LAVERTON" as the value in a "location__c" field against the Product record. I'd want to do this for age, assetcondition, assetlocation, make etc etc.
I can see lots of examples of using LEFT and MID but haven't been able to create a dynamic enough formula - data in this tags field will vary a lot, so I can't specifiy exact start and end text positions.
Any advice appreciated!
Thanks
I have a field against the Product object, Tags, which contains data such as the following, imported from a thrid-party system:
age:< 12 Months, assetcondition:BRONZE, location:LAVERTON, make:POS SYSTEM, model:3212, power:SIN10AMP, rentalstatus:AVAIL-W, serial:100285954, subcatcode:Swift AssetsWhen these Product records are created I want to use formulas in a Process Builder Workflow action to extract each "key:<value>" pair, storing all <value>'s in custom fields.
As an example based on the above, one of the formulas would search for "location:" and store "LAVERTON" as the value in a "location__c" field against the Product record. I'd want to do this for age, assetcondition, assetlocation, make etc etc.
I can see lots of examples of using LEFT and MID but haven't been able to create a dynamic enough formula - data in this tags field will vary a lot, so I can't specifiy exact start and end text positions.
Any advice appreciated!
Thanks
You can try apex trigger instead process builder. check below code, or You can use apex invokable method inside the process builder to extract data and update relevant fields.
regards
yourObjectName would be replaced with product2 (the standard SF Product object)
If the field containing the tags was called tags__c, would that need only be referenced in line 4:
string nameWithComma= c.tags__c;
and other instances of name/Name are up to me?
Sorry if these are stupid questions!
Thanks!
Yes, In your scenario, yourObjectName = product2.
If the field containing the tags was called tags__c, then
string nameWithComma= c.tags__c;
Set other variables according to your custom/ system fields.
You can try https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro (https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro)