Skip to main content
1-Visitor
March 13, 2019
Solved

Creating Media entities and style definitions through scripting

  • March 13, 2019
  • 7 replies
  • 3225 views

How can i go for creating Media entities and style definitions through service scripting?

Best answer by mnarang

For style:

var params = {
name: "MyStyle12" /* STRING */,
description: undefined /* STRING */,
content: { "content":
{ "params" : "",
backgroundColor: "",
displayString: "",
fontEmphasisBold: false,
fontEmphasisItalic: false,
fontEmphasisUnderline: false,
foregroundColor: "",
image: "",
lineColor: "",
lineStyle: "solid",
lineThickness: 1,
secondaryBackgroundColor: "",
textSize: "normal",
description: ""
//name: "TestScriptStyle"
//tags: [] /* JSON */,
}
}
//tags: undefined /* TAGS */}
};

// no return
Resources["EntityServices"].CreateStyleDefinition(params);

 

 

 

For media ,the content type requires is image ,so get the content type from LoadImage and then use it there liek this :

 


var params1 = {
proxyScheme: undefined /* STRING */,
headers: undefined /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: undefined /* STRING */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */
};

// result: IMAGE
var result = Resources["ContentLoaderFunctions"].LoadImage(params);

var params = {
name: undefined /* STRING */,
description: undefined /* STRING */,
content: result /* IMAGE */,
tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateMediaEntity(params);

 

 

Thanks ,

Mukul Narang 

7 replies

5-Regular Member
March 13, 2019

For style definitions :


var params = {
name: undefined /* STRING */,
description: undefined /* STRING */,
content: undefined /* JSON */,
tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateStyleDefinition(params);

 

 

For Media entity:

 


var params = {
name: undefined /* STRING */,
description: undefined /* STRING */,
content: undefined /* IMAGE */,
tags: undefined /* TAGS */
};

// no return
Resources["EntityServices"].CreateMediaEntity(params);

 

 

Thanks,

Mukul Narang

muzzammil1-VisitorAuthor
1-Visitor
March 14, 2019

Hi @mnarang , Actually i know that the snippets are there for creating media entity and style definition, but, i don't know how to assign content values in those snippets. So, kindly give some example to explain it

16-Pearl
March 14, 2019

@muzzammil : entities attached .that will help in creating media & style def entities through services.