{"id":2472,"date":"2013-01-08T11:15:05","date_gmt":"2013-01-08T11:15:05","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=2472"},"modified":"2013-01-23T23:54:48","modified_gmt":"2013-01-23T23:54:48","slug":"removing-a-reference-value","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/removing-a-reference-value","title":{"rendered":"Removing a reference value"},"content":{"rendered":"<p>I needed to delete all the Managers from people in the FIM Portal where a particular Manager was set. I had blithely assumed this would be easy with the FIM PowerShell plugin &#8211; sadly, not so.<\/p>\n<p><!--more--><\/p>\n<p>You can clear a string value easily enough by setting it to an empty string. So this works:<\/p>\n<pre>$ImportObject = ModifyImportObject -TargetIdentifier $ID -ObjectType 'Person'\r\nSetSingleValue -ImportObject $ImportObject -AttributeName 'MiddleName' -NewAttributeValue ''\r\nimport-fimconfig -ImportObject $ImportObject<\/pre>\n<p>However change that string attribute to a single-valued reference attribute like Manager and you get this helpful error:<\/p>\n<pre>Import-FIMConfig : Failure when making web service call.\r\n\r\nSourceObjectID = <em>guid<\/em>\r\nError = The web service client has encountered the following class of error: Other\r\nDetails: Additional Text Details: Request could not be dispatched.<\/pre>\n<p>Note that I&#8217;m only having this problem because my reference attribute is single-valued &#8211; for multi you can actually delete any specific value, including the last one, essentially nulling the field. But for single-valued you can&#8217;t use the Delete operation &#8211; you have to use Replace, and it won&#8217;t let you replace it with a null or empty string.<\/p>\n<p>Eventually I figured out that I could actually delete the value using a workflow with just the OOB Function Evaluator activity. Set the reference attribute to a space (not an empty string for some reason &#8211; I had to put a space as the string), run the workflow against the set of people with the Manager I needed to remove, and I got the job done.<\/p>\n<p><strong>Update:<\/strong> It turns out that setting to a space also works for nulling a Boolean attribute.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed to delete all the Managers from people in the FIM Portal where a particular Manager was set. I had blithely assumed this would be easy with the FIM PowerShell plugin &#8211; sadly, not so.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[60,23,45],"tags":[],"class_list":["post-2472","post","type-post","status-publish","format-standard","hentry","category-fim-2010-r2","category-powershell","category-workflow"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-DS","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=2472"}],"version-history":[{"count":3,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2472\/revisions"}],"predecessor-version":[{"id":2482,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2472\/revisions\/2482"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=2472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=2472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=2472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}