Forum Replies Created
-
AuthorPosts
-
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?
The list is just a custom list with Content Approval turned on. But your jQuery code worked perfectly. Thank you!
February 20, 2018 at 16:00 in reply to: DFFS > Filtering Checkbox based on another field answer #19931How would you do this if ChoiceColumn3 is a drop-down rather than a checkbox?
Nevermind. I see my mistake.
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);
});
}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, 3 months ago by Brett Ross.
-
AuthorPosts