Assign Current User Id to a relationship field in a create p

Posted by ithrees on 06-Aug-2014 05:16

In this portal, logged in portal user can create any number of related object records where I need to assign the CURRENT USER as the relationship field value so the newly created records will be linked to the current user.

How this can be achieved pls?

All Replies

Posted by Orchid Corpin on 06-Aug-2014 08:47

Hi ithrees,

You can achieve this through Trigger > Update Field Value > Specify timing as After Create.
In the drop down "Field to change" specify the related record (which should be same as the object with the portal user)
In the formula return textarea just specify {!createdBy} - this will return the ID of the creator.

Hope this may help.

Regards,
Orchid

Posted by romain.pennes@foederis.fr on 06-Aug-2014 10:27

Hi,

To complete Orchid's comment,

You may also use {!#CURR_VISIT.id} which will return the "connected portal visitor", which should be similar to {!createdBy} in that case.

Note that portal visitors are totally separated from UI users. (A portal visitor is any object for which you have checked the "portal visitor" attribute, as opposed to UI users which are records from the shipped in Rollbase object "USER")

Cheers,

Romain

Posted by ithrees on 06-Aug-2014 10:47

Thank you Orchid and Romain,

I tried with {!createdBy} earlier also but no luck, {!#CURR_VISIT.id}  works fine.

Thank you both.

Posted by Orchid Corpin on 06-Aug-2014 12:14

That's Great! Thank you Romain for the answer, very much appreciated.

Regards,

Orchid

This thread is closed