I need to create some attachments in Online (from a customApp) and have figured i need to create a CRMscript that creates this attachment for me since i cant use the standard API to do this.
I have tried using the CRMscriptAgent to execute the script, and pass inn a string representation of the byteArray as a parameter:
var byteArray = httpClient.GetByteArrayAsync("document/4098?id=71&docid=2");
string docString = System.Text.Encoding.UTF8.GetString(byteArray.Result);
var docStringDictionary = new SuperOffice.CRM.Services.StringDictionary();
using (var scAgent = new SuperOffice.CRM.Services.CRMScriptAgent())
var scEntity = scAgent.GetCRMScriptEntity(42);
var temp = scEntity.Description;
catch (AggregateException ex)
This is just an initial test if i can use this agent, and in the example above im able to get the crmscript.Description (temp) and other values. The script itself also validates OK if i use the ValidateScript-method.
If i add any 'normal ways to fetch values in a script' it fails with this exception:
Does anyone have an example on how i use the executeScript-method and how i fetch the parameters in the script?
It looks like it fails if i use any of the global functions like getCgiContent(), getCgiVariableArray() etc.
Edit: I also notice that if i enable tracing on a script it does not notice if my code is executed through the CrmScriptagent. If i edit my script to only continain this:
It does not fail when executing it through the agent,and should in theory be 'ok and run just fine'.
Am I doing this all wrong?
I could try to do a POST from my customApp to the script instead, and get the byte with getCgiContent() instead (?), but it would be better to use the scriptAgent since i already have a valid session in my application.