-1

I am "translating," some code from CSOM/C# to JSOM and got to a statement that is a bit unfamiliar to me. I would like to avoid mixing the CSOM and JSOM if possible the statement is as follows:

var def = from defs in publishedWorkflowDefinitions
      where defs.DisplayName == workflowName
      select defs;

I am not sure what exactly from, where, and select are in JSOM. I tried logging the object properties to the console, and got the following

SP.WorkflowServices.WorkflowDefinitionCollection {$0_0: SP.ClientContext, 
$5_0: SP.ClientObjectData, getEnumerator: ƒ}
$0_0: SP.ClientContext {$1F_0: {…}, 
$w_0: "/Site/ThisSite", $1C_0: true, $2I_0: false, 
$8_0: SP.ClientRequest}
$5_0: SP.ClientObjectData {$e_0: SP.ObjectPathMethod, 
$C_0: SP.ClientQueryInternal, $H_0: {…}}
getEnumerator: ƒ ()

Any reference links to where I can find additional info about this topic would be great. I have changed much of the code already, but this part is a bit confusing.

I am using SharePoint 2013.

1 Answers1

0
ctx.executeQueryAsync(
    function(){
        var e = wDefs.getEnumerator();
        while (e.moveNext()) {
            var def = e.get_current();
            alert(def.get_displayName() + " id: " + def.get_id());
        }
    },
    function(a,b){
        alert(args.get_message());
    }
);
  • 1
    Please explain the code in your answer. [From Review](https://stackoverflow.com/review/low-quality-posts/18476019). – Wai Ha Lee Jan 10 '18 at 12:04
  • Move through Workflow Definitions, as long as one exists, then alert the display name... Not sure what else to say. – 贝壳 - BeiKe Jan 16 '18 at 10:22