Rule using value in a calculated field

Home Forums Classic DFFS Rule using value in a calculated field

Viewing 1 reply thread
  • Author
    Posts
    • #9650
      Gerard Graham
      Participant

        Hi there

        I’d like to use the value of a calculated field when deciding if a rule should run or not., but I see the calculated fields are not listed in the If this trigger drop down. I also tried to see if I could set a field to the value of a calculated field on load, but I get the name of the field instead of its value (e.g. {repStatus} is the set value)

        Any suggestions please?

        Thanks

        Gerry

      • #9663
        Alexander Bautz
        Keymaster

          Hi,
          Calculated columns are available in DispForm only. This is not a DFFS issue, but how calculated columns work in SP.

          You can however make this work if you use the trigger “Custom JavaScript function”, and use a query to get the value from the calculated column.

          Here is an example of getting the calculated column value:

          function getCalculatedColumnValue(){
          	var r = false, v = "", qRes = spjs.utility.getItemByID(
          		{
          			"listName":_spPageContextInfo.pageListId,
          			"id":spjs.dffs.data.thisItemID,
          			"viewFields":["YourCalculatedColumn"]
          		}
          	);
          	if(qRes !== null){
          		v = qRes["YourCalculatedColumn"].split(";#")[0];
          	}
          	if(v === "The value you want to compare with"){
          		r = true;
          	}
          	return r;
          }

          This code is written “free-hand” and not tested, but it should work.

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.