Autocomplete setFields SPFieldUser

Home Forums Autocomplete Autocomplete setFields SPFieldUser

Viewing 2 reply threads
  • Author
    Posts
    • #27463
      BenR
      Participant

        Alexander,

        I am attempting to setFields from a SPFieldUser to SPFieldUser, both named FinanceManager:

        
        
            {
        	"fromFIN":"FinanceManager",
                "joinBy":"",
        	"toFIN":"FinanceManager",
                "parseFunction":"",
                "skipIfEmpty":false
        	},

        In my toFIN, I am getting lastName firstName as two values instead of one – see attachment.

        How can I accomplish my objective?

        In advance, I appreciate your support and efforts!

        R’grds – Ben.
        Reference:
        Version information

        DFFS Loader: v2
        DFFS frontend: 4.4.4.13 – October 14, 2019
        DFFS frontend CSS: 4.51 / 4.51
        Autocomplete: 1.6.38 – October 14, 2019
        Cascading dropdowns: 3.7.31 – October 14, 2019
        jQuery: 1.12.4
        Lookup: 1.1.18 – October 14, 2019
        Resource management: 2.4.5 – August 29, 2019
        SPJS-Utility: 1.337 – September 04, 2019
        vLookup: 2.2.138 – September 04, 2019

      • #27472
        Alexander Bautz
        Keymaster

          This is because when you set a PP and the value has a comma in it, the value is interpreted as two different names.

          The solution is different if you use REST or not – see code examples below.

          With “useREST”: false

          {
              "fromFIN": "FinanceManager",
              "joinBy": "",
              "toFIN": "FinanceManager",
              "parseFunction": "fixPP_NO_REST",
              "skipIfEmpty": false
          },

          Add this function below the call to spjs.ac.textField({…});

          function fixPP_NO_REST(a){
              var r = "";
              try{
                  var user = spjs.utility.userInfo(a[0].split(";#")[0]);
                  r = user.Name;
              }catch(ignore){
                  // Nothing
              }
              return r;
          }

          With “userREST”: true

          {
              "fromFIN": ["FinanceManager/Name"],
              "joinBy": "",
              "toFIN": "FinanceManager",
              "parseFunction": "",
              "skipIfEmpty": false
          }

          Alexander

        • #27474
          BenR
          Participant

            Alexander,

            Nicely done! Thank you so much for your support and efforts!

            R’grds – Ben.

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.