7 Replies · Latest reply on Dec 28, 2017 5:57 AM by Paul Jackson

    Query on updating a multi-line field in AD via Orchestration

      Hi,

       

      Looking for some assistance with a query I have.  I am looking to update the Address field in Active Directory via Orchestration but am running into issues due to the fact that this is a multi-line field I believe, for example:

       

      Address Line 1

      Address Line 2

      Address Line 3

       

      Has anyone come across this before and if so, how did you get around the issue or any other suggestions on how to update this.

       

      Do I need to pass the value through as an array?

       

      Cheers,

      James

        • Re: Query on updating a multi-line field in AD via Orchestration
          Slava

          What is the exact issue you encounter when trying to set it up?

          ------------------------------------
          Slava Savitsky
          Senior Technical Consultant
          Fruition Partners, a DXC Technology Company
          www.fruitionpartners.eu

          • Re: Query on updating a multi-line field in AD via Orchestration
            Vivek Sattanatha

            Hi James,

             

            Yes!! You have to split the field in the run script by '\n' then pass it on an array. Suppose your field is like this,

             

            Addr = Address Line 1

                       Address Line 2

                        Address Line 3

             

            var ary = Addr.toString().split('\n');

            workflow.scratchpad.street = ary[0];

            workflow.scratchpad.city= ary[1];

            workflow.scratchpad.postalcode= ary[2];

             

            I believe you are not facing issue in Powershell

             

            Regards,

            Vivek

             

            Based on the impact hit like, helpful or correct

              • Re: Query on updating a multi-line field in AD via Orchestration
                James Finnerty

                Hi,

                 

                Many thanks for your reply.  I have tried your suggestion and I am able to split the address into three separate lines and have confirmed this by printing to the work-notes on the request item.

                 

                However, when I push this across to Active Directory, it comes across as below all on one line.

                 

                AD Address.JPG

                 

                 

                I have a variable called 'address' on the catalog item.  The username is hardcoded into the Update AD activity to remove that from the equation.

                 

                I then have the following script which splits the address into an array:

                 

                var Addr = current.variables.address;

                 

                var ary = Addr.toString().split('\n');

                workflow.scratchpad.street = ary[0];

                workflow.scratchpad.city= ary[1];

                workflow.scratchpad.postalcode= ary[2];

                 

                workflow.scratchpad.address = workflow.scratchpad.street + "\n" + workflow.scratchpad.city + "\n" + workflow.scratchpad.postalcode;

                 

                //Below line of code is for testing only so that I can see the output of the above code

                current.work_notes = workflow.scratchpad.address;

                 

                 

                I then pass the following into my Update AD Object activity in Orchestration:

                 

                {"streetAddress" : "${workflow.scratchpad.address}"}

                 

                Any thoughts on where I am going wrong on this?

                  • Re: Query on updating a multi-line field in AD via Orchestration
                    Vivek Sattanatha

                    Hi James,

                     

                    I believe streetAddress attribute is only meant for the street. So technically you are moving everything into Street parameter.

                     

                    So your update AD object has to be like this

                     

                    {"streetAddress" : "${workflow.scratchpad.street}"}, {"City" : "${workflow.scratchpad.street}"}, {"PostalCode" : "${workflow.scratchpad.postalcode}"}

                     

                    Regards,

                    Vivek

                     

                    Based on the impact hit like, helpful or correct

                    ,

                      • Re: Query on updating a multi-line field in AD via Orchestration
                        James Finnerty

                        Hi Vivek

                         

                        Thank you for your time and sorry for the late reply.  In our company, a lot of our users use this field to store their full office address so this was why I was looking to be able to update this in the same format.

                         

                        This is what it currently looks like on the catalog item:

                         

                        Catalog Item Address.JPG

                        When I update the AD object, the first image below is what I am hoping to achieve but instead, it is all going in on one line similar to the second image below.

                         

                         

                         

                         

                         

                        I have tried multiple variations such as below:

                        {"StreetAddress":  "MyCompany Plc \r\nNumber 1"}

                        Result:  Failure with error message: 

                         

                        AND

                         

                        {"StreetAddress":  "MyCompany Plc \r\\nNumber 1"}

                        Result:  Partial Success

                         

                        The field does update but unfortunately, it does so incorrectly.

                         

                        Any other thoughts on what I could try here?

                         

                        If not, I will just go with a single line text box and the guys can edit the address afterwards but would prefer not to go this way if possible as this replicates across to a couple of other systems so would like to have it correct from the start.

                         

                        Many thanks again for all your assistance.

                         

                        Cheers,
                        James