Brett Ross

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Set field value to yyyymm of date field in form #35405
    Brett Ross
    Participant

      I’m trying to use this but, it is giving me an error. Here’s the code I’m using:

      function setCustomDateStr(){
      var d = spjs.utility.getDateFieldAsDateObject(“DateServicesProvided”);
      var dStr = d.getFullYear() + String(d.getMonth() + 1).padStart(2,”0″);
      setFieldValue(“YearMonth”, dStr);
      }

      When the date changes, I get an error that says the “TypeError: d.getFullYear is not a function”. If I click OK, the function works and the correct number is filled in. But how do I get rid of that error?

      in reply to: Approval Status Field Showing #20063
      Brett Ross
      Participant

        The list is just a custom list with Content Approval turned on. But your jQuery code worked perfectly. Thank you!

        in reply to: DFFS > Filtering Checkbox based on another field answer #19931
        Brett Ross
        Participant

          How would you do this if ChoiceColumn3 is a drop-down rather than a checkbox?

          in reply to: Pull user info from a people picker #19220
          Brett Ross
          Participant

            Nevermind. I see my mistake.

            in reply to: Pull user info from a people picker #19218
            Brett Ross
            Participant

              I’ve had this working since July, and all of a sudden now, it’s no longer working. I’m pulling in the Contract Manager’s work phone number from the user profiles. Here’s my code.

              $.each(spjs.utility.getFieldValue({“fin”:”Contract_x0020_Manager”,”key”:”loginName”}),function(i,login){
              var ppData = spjs.utility.userInfo(login);
              console.log(ppData);

              var userProfile = spjs.utility.userProfile(login);
              console.log(userProfile);
              setFieldValue(“CM_x0020_Phone_x0020_Number”,userProfile.WorkPhone);
              });

              I’ve also tried wrapping it in a function, then writing a rule that says, any time the Contract Manager field changes, run the function. But that doesn’t work either.

              function PopulatePhone ()
              {
              $.each(spjs.utility.getFieldValue({“fin”:”Contract_x0020_Manager”,”key”:”loginName”}),function(i,login){
              var ppData = spjs.utility.userInfo(login);
              console.log(ppData);
              // User profile is not available in SP Foundation
              var userProfile = spjs.utility.userProfile(login);
              console.log(userProfile);
              setFieldValue(“CM_x0020_Phone_x0020_Number”,userProfile.name_of_property);
              });
              }

              in reply to: Pull user info from a people picker #17488
              Brett Ross
              Participant

                I’m not a programmer, so I need a little more instruction. I’ve added this to the Custom JS textarea and changed PeoplePicker1 to my field name. But how do I tell it what field to populate? And how do I change it if I want to pull in other properties like the phone number?

                • This reply was modified 7 years, 5 months ago by Brett Ross.
              Viewing 6 posts - 1 through 6 (of 6 total)