cancel
Showing results for 
Search instead for 
Did you mean: 

Assign person custom field with a person

tchenm1
Champ in-the-making
Champ in-the-making
During a workflow progression I would like to set a custom type persons field to different people.

The "sop:sourceSubPerson" is our custom field associated to the parent folder of the document. However this line of code is not working.

parentFolder.properties["sop:sourceSubPerson"] = people.getPerson("Bautista");

Any input would be appreciated.
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

please keep in mind that any changes to properties in a JavaScript-based action / script will only be saved when you explicitly call the save() method on the ScriptNode.

In your case:
<blockcode>
parentFolder.properties["sop:sourceSubPerson"] = people.getPerson("Bautista");
parentFolder.save();
</blockcode>

Regards
Axel

tchenm1
Champ in-the-making
Champ in-the-making
Hi AFaust,

Yes, I did call a save method just didn't include it in the code sample. I think the problem with the custom field (sop:sourceSubPerson) is that it is an association to the cmSmiley Tongueerson class. When I view the node, I see that the sop:sourceSubPerson property contains the name. However, it does not appear in the Share interface.

When I populate the field through the share interface and view the node, the Association of the node is populated with the person target reference. So am I to assume I need to be saving an association? And how would I do that?

Thanks so much!!

Mike T

tchenm1
Champ in-the-making
Champ in-the-making
After surfing the forums below was the solution I emulated, hope it helps others. My custom field sop:sourceSubPerson was an association to cmSmiley Tongueerson so an update to properties method did not do anything. An association must be created in the node containing the custom field and that was done by the below.

var parentFolder = document.parentAssocs["cm:contains"][0];
var person = people.getPerson('Bautista');
parentFolder.createAssociation(person, "sop:sourceSubPerson");
parentFolder.save();