CRMscripts: "completed" on sale, currentProject


I have 2 quick questions on CRMscripts: 
1. I can't seem to find the value "completed" from EventData, do anyone know a way i can detect if a sale is set to "completed" or not? 
In my scenario i want to set/make sure a sale is set to "un-completed" but I cant figure out where i can get/set the value.
Shouldnt this be possible through setOutputValue?

2. I know CRMscripts dont have any knowledge of e.g "CurrentProject", so i cant set values on a new sale with e.g SaleEntity.Heading = CurrentProject.Name. 
We have some customer who has WinScripts with this functionality, and i am trying to figure out a way to get 'everything' over to Web/CRMscripts. 

Maybe someone has figured out something 'smart' regarding this, so that similar functionality would be possible with CrmScripts? =) 


RE: CRMscripts: "completed" on sale, currentProject

2. Can't you just do it with SearchEngine? Something like this:


String projectName;

SearchEngine se;
se.addCriteria("sale.sale_id", "Equals", saleId);
if( > 0)
  projectName = se.getField(0);
Av: Simen Mostuen Iversen 1. feb 2018

RE: CRMscripts: "completed" on sale, currentProject

well, yes, but that is not what i am looking for =) 
When i create a new sale i want to 'fetch' currentProject (e.g. the last project i had open) and connect that project to the sale. 
I dont think this is possible in Web/CRMscript anyways, it doesnt look like it anyways :(


Av: Eivind Johan Fasting 1. feb 2018

RE: CRMscripts: "completed" on sale, currentProject


  1. I guess with "Completed", you mean "Sold"? I believe this is "SaleStatus" = 2.
  2. The current whatever is what is at the top of the History. You can access the history table directly, or use NSViewState to get the current project for the active associate:

NSViewStateAgent a;
NSHistory h = a.GetCurrent("project");


Av: Sverre Hjelm 2. feb 2018