Preventing the change of unique identifier in NERM

I have a workflow to create profiles. One of its steps is “Set attribute value” to calculate a unique identifier with the help of a “Value Builder”.

I am trying to add a “Prevent Duplicates” step and it works correctly, however, when I select the “Modify an existing profile” option it changes the unique identifier, for example, if it was originally ID-0001, it is now ID-0002.
I have added a condition indicating that if the unique identifier is missing, then I have added it but it does not work, because apparently, when I select the option “Modify an existing profile” the ID is empty because it is not captured in the form, if not calculated in the workflow.

Is there any way to save the ID I had before and not modify it?

When you select “Modify an existing Profile”, it pulls a profile into the request. Two possible condition configurations that you could use here:

First: After the Duplication Prevention action, You can use a condition that checks if both the Request and the Profile for the ID value is absent. If it is absent from both, then you can set a new value with the Set Attribute Values action.

Second: You could change that Condition to look for a Profile after the Duplication Prevention action. A Condition that checks for “Profile absent” would return True if you select to create a new Profile and would return False if you select to modify an existing Profile. Then, in that condition step, you can add your Set Attribute Values action to set the ID value - because if there is No Profile, then you know you definitely need to set a value for the one you are creating

2 Likes

Thanks for the answer, I have tested it and it works when I select “Modify an existing profile”, however, I have a problem, the conditions do not work when there is no duplicate profile (i.e. when it is a “normal” request) or when I select “create a new profile”.
The condition is never true and leaves the unique identifier empty. I guess it is because it does not incorporate a profile in the request so when it validates if the profile is absent, it returns null or something similar.

Is there any way to handle this?

It makes sense to me that the second option you commented would work, however, it doesn’t, although maybe the configuration is not correct. At the moment my workflow looks like this (Identificador unico del proveedor is my ID attribute):


Update: I leave what I implemented as a solution in case someone can use it in the future.
I created an attribute as a flag called id_flag which is originally FALSE.
Then, if it is a modification of an existing profile, it is valid if the profile is present, as the condition is true, then I update the value of the flag to TRUE, if no profile exists and the condition returns null, the flag keeps the value FALSE.

Then, I validate if the flag is FALSE, if so I know that I need to create a unique identifier and I calculate it, otherwise I don’t do it and I keep the one that the profile had originally.