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
David OvellaDavid Ovella 

Can a field text be saved in different ways depending on picklist?

I have a field text called "Nro_Ruc__c", and I want to save it in different ways depending of the values of a picklist called Identificador__c
Example:
If Identificador__c == RUC
    the Nro_Id__c will be saved like: "12345678-9"
If Identificador__c == CI
    the Nro_Id__c will be saved like: "123.456.789"
If Identificador__c == TEDF
    the Nro_Id__c will be saved like: "12-34-56-78-99"

User-added image
James LoghryJames Loghry
Are you filling Nro_Id__c with other data too?  I ask, because this would be a great candidate for a formula field rather than a simple text field, if Nro_Id__c can be read only.

Otherwise, you're looking at a simple process that can update the Nro_Id__c field when Indentifcador__c is a certain value.
David OvellaDavid Ovella
Nro_Id__c needs to be edited sometimes, so I don't know if the way would be a formula field, and if it is a formula, how it will work?