Thank you so much for your response… through that we can able to assign users to organization through bulk load. But we got the scenario where we need to assign users to multiple organization while bulk load.
I tried to use this code but it’s not doing it somewhere I am getting error. Can you provide me a workaround if possible.
Thank you for your previous response using that I could able to achieve the requirement… I have got one requirement that lets say if I create a relationship based on organization name if update is required I need to remove previous relationship i.e., remove the previously configured “memberOf” data and create new relation.
hi @Suriya
To do that, instead of patching the object with "operation":"add" I think I would use "operation":"replace". Or I’ll do it with 2 steps : 1/ "operation":"remove", 2/ "operation":"add".
Regards,
Steph
Thank you for your inputs. I have tried this but since it is object operation BTW I don’t know that may be the reason it’s not removing or replacing it.
For me this scenario is used in two different places
One parent-child organization relationship, where I need to remove previous relation and create new one.
users-organization relationship, where I need to remove the previous relationships (because user’s maybe the member of different organization).
In simple terms, removing previous one is required, adding we can utilize existing set of codes.
@suriya Is it the remove operation that does not work? This operation is particular in that you need to pass in the entire relationship object in the value to remove as specified here: Knowledge - ForgeRock BackStage
The current flow I am following is when admin creates new user in the Form (created through journey) provide the organization name so post creation I have used the below script with “operation:add” to create relationship.
var orgname = object.organizaton_name;
var org = openidm.query(“managed/alpha_organization”,{ “_queryFilter”: “name sw "”+orgname+“"”},[“_id”]);
if(org){
var patchedUser = openidm.patch(“managed/alpha_user/” + object._id, null, [{
“operation”:“remove”,
“field”:“/memberOfOrg/-”,
“value”:{“_ref”:“managed/alpha_organization/”+org.result[0]._id+“”,“_refProperties”:{}}
}]);
}
So I have applied “remove” in above operation field which does not remove the previous relationship. I even used “replace” as suggested but it does not do any changes.
Please have a look on the above script and provide suggestion if anything needed.
But the above operation is working for “/parent” object for changing parent organization.
I am facing issue only in “/memberofOrg/-” where I guess multiple selections are possible. So I need to understand that specific change required for this operation i.e., removing all previous relation and add one. Adding one is not issue for me but removing is where I am facing issue