cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete an attribute value for a multi-valued attribute

paul_abrahamson_sap
Active Participant
0 Kudos

Hi,

We have a requirement to remove an attribute value from an MX_PERSON record for a mutli-valued attribute by means of a JavaScript called from a generic pass.

Using the internal function uIS_SetValue we can set values on the multi-valued attribute (this adds the value). You can remove all values for the attribute by setting it to "" e.g. outString = uIS_SetValue(mskey, idStore, attributeName, "").

The result is that all attributes values are removed.

The value we want to remove can only be determined at runtime via logic in our script, so we can't really replicate this by calling a task using a To Identity Store pass.

To achieve this in a To Identity Store Pass there is the option to set the value for the attribute to %attributeValue%. This removes the specified value if its found.

How do we achieve a similar result in a generic pass via a script?

Potentially we could set up a task with a normal To Identity Store pass and call this task using uProvision, having already stored the attribute value we want to remove in a context variable. We'd then need to retrieve that context variable in the To ID Store pass.

Before I go down some convoluted route, perhaps you know if there's a user function to remove a specific multi-valued attribute value.

Worst-case scenario, we can work around this by first removing all the values and then add the values we want to keep back into the attribute, but this creates a rather untidy auidt trail and history record.

Thanks

Paul

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The documentation for uIS_SetValue is wrong for the Java version... It should look almost identitcal to the VB version, and is actually:

OutString = uIS_SetValue(<Entry ID>, <IdStore>, <Attribute Name>, <Attribute Value>, [<User ID>], [<Attribute Operation>]);

[<Attribute Operation>] is what you need to set. From the help definition:


Optional. Specifies which operation to perform. Possible values are:
0: Multivalue: Add

    Single value: Replace or add (if not existing)
1: delete case sensitive

2: delete case insensitive

The default value is 0.

So, lets say you have a multivalue attribute "COLORS" for entry 12345 ("Monitor") with "red", "green", "blue" and "mauve" as values. Obviously mauve doesn't belong, so we'd remove it with:

uIS_SetValue(12345, 0, "COLORS", "mauve", "", 2);

You could probably use 1 or 2, but I'm always afraid of breaking case.

That said, I agree with Holger, you should just use a ToIdentityStore pass for this, I don't know why you'd be REQUIRED to use a ToGeneric (I hate ToGeneric, myself, and avoid them whenever possible). Good luck!

paul_abrahamson_sap
Active Participant
0 Kudos

The reason we didn't want to do this in a normal To IDS pass is that the logic that is executed in the JavaScript before the point at which we need to remove the attribute value, is sufficiently complex to not make it feasible to include in a To Identity Store Pass.

What we're doing is cross-referencing two identities to each other. We have a custom multi-valued attribute on MX_PERSON called Z_RELATED_IDS which references MX_PERSON. (MX_OWNER was not suitable for this purpose). When an entry B is added to Identity A, the cross-reference from B back to A is added. When entry B is removed from identity A, the cross reference back to A needs to be removed from B.

The generic pass allows us to do the complex reconciilliation in a JavaScript from identity A and all it's related identities to determine the adds and deletes and clean up any potential orphans using the uIS_SetValue function.

Thanks for all your input.

Former Member
0 Kudos

Hi Adam,

Thank you for this information.

But if you have a multivalue attribute "COLORS" for entry 12345 ("Monitor") with "red"  and "red" as values and if  we want to remove both values then it does not happen using below function

uIS_SetValue(12345, 0, "COLORS", "");

I have posted this issue on .

Could you please assist ?

Thanks!!

Regards,

Pradeep

Answers (2)

Answers (2)

thomas_groth2
Explorer
0 Kudos

All said above.

Edited by: Thomas Groth on Nov 24, 2010 4:27 PM

Former Member
0 Kudos

Hi Paul,

why don't you just use the following in the ToIdentityStore pass:

AttributeName $FUNCTION.getYourAttributeToBeRemoved(Parameters)$$

Best regards

Holger