Answered

Set File in Collection Item

I am trying set attribute "Vlozhenie" (file type).

I do:

var taskId = <Taskforhelp.Identifikator>;

var list = CEntityManager.GetEntity("Predydushchiedeystviyapo").GetEntityList("SotrForHelpID", taskId, "" ,"");

SurrogateKey = list[0].SurrogateKeyValue;

CHelper.setAttrib("Predydushchiedeystviyapo",SurrogateKey,"Statusdeystviya","Завершено");CHelper.setAttrib("Predydushchiedeystviyapo",SurrogateKey,"Datazaversheniya", DateTime.Now);CHelper.setAttrib("Predydushchiedeystviyapo",SurrogateKey,"Otvetotispolnitelya", <Taskforhelp.Commentfortask>);

var OriginalFile = Me.getXPath("Taskforhelp.Vlozhenie");

//Go through the array of filesfor(var j=0; j < OriginalFile.size(); j++){//Obtain the file data var FiletoCopy = OriginalFile.get(j); var Name = FiletoCopy.getXPath("FileName");CHelper.trace("copyfile","Name = " + Name); var Data = FiletoCopy.getXPath("Data");//Copy the file in the file-type attribute of the collectionvar NewFile = Me.newCollectionItem("list[0].Vlozhenie")CHelper.trace("copyfile","NewFile = " + NewFile);NewFile.setXPath("FileName", Name); NewFile.setXPath("Data", Data);}//Intitialize the file-type attribute<Taskforhelp.Vlozhenie>=null;

I was trying to do this:

CHelper.setAttrib("Predydushchiedeystviyapo",SurrogateKey,"Vlozhenie", <Taskforhelp.Vlozhenie>);

But it does not work.

Help me please!

Best Answer
photo

Dear Sofya,

In Bizagi, you may upload any file to a File-type attribute without an end user's intervention using an expression uploading the content of the file (as an Array of typesbyte). For example, in a Loans Request Process the Process Entity is called Request. Assume in this entity there is a File-type attribute called HistoryFile that will store a letter uploaded via Web service.

For further information: http://help.bizagi.com/bpmsuite/en/index.html?upload_a_file_to_an_attribute_.htm

It is also possible to copy the content of a file-type attribute to another of the same type contained in a collection. Imagine a process where documents are uploaded along the process. The process keeps a log of uploads; a collection stores the files, dates of upload and users that uploaded them as shown bellow.

To check an example to guide you as you need, please check: http://help.bizagi.com/bpmsuite/en/index.html?copy_the_file_content_from_one.htm

Regards

photo
0

Dear Sofya,

In Bizagi, you may upload any file to a File-type attribute without an end user's intervention using an expression uploading the content of the file (as an Array of typesbyte). For example, in a Loans Request Process the Process Entity is called Request. Assume in this entity there is a File-type attribute called HistoryFile that will store a letter uploaded via Web service.

For further information: http://help.bizagi.com/bpmsuite/en/index.html?upload_a_file_to_an_attribute_.htm

It is also possible to copy the content of a file-type attribute to another of the same type contained in a collection. Imagine a process where documents are uploaded along the process. The process keeps a log of uploads; a collection stores the files, dates of upload and users that uploaded them as shown bellow.

To check an example to guide you as you need, please check: http://help.bizagi.com/bpmsuite/en/index.html?copy_the_file_content_from_one.htm

Regards

photo
0

I read this. It is not help me.

Please, help me.

photo
0

I need update collection item , not insert new item.

photo
0

Dear Sofya,

Here is an example to update a collection. To do so navigate the list of requests and use the CHelper.setAttrib function.

chelper95_zoom68//Obtain the list of cases of the user evaluatedvar IdCustomerEvaluated=<CustomersFollowUp.CustomerEvaluated.id>

var ListOfRequests = CEntityManager.GetEntity("CreditRequest").GetEntityList("", "","idRequester="+IdCustomerEvaluated, "");

//Update each case

for (var i=0;i<ListOfRequests.Count;i++)

{

CHelper.setAttrib("CreditRequest",ListOfRequests.SurrogateKeyValue,"RequestPenalized",true);

}For further information: http://help.bizagi.com/bpmsuite/en/index.html?obtain_and_use_entity_values.htmRegards

photo
0

Juan Zuluaga wrote:

Dear Sofya,

Here is an example to update a collection. To do so navigate the list of requests and use the CHelper.setAttrib function.

chelper95_zoom68//Obtain the list of cases of the user evaluatedvar IdCustomerEvaluated=<CustomersFollowUp.CustomerEvaluated.id>

var ListOfRequests = CEntityManager.GetEntity("CreditRequest").GetEntityList("", "","idRequester="+IdCustomerEvaluated, "");

//Update each case

for (var i=0;i<ListOfRequests.Count;i++)

{

CHelper.setAttrib("CreditRequest",ListOfRequests.SurrogateKeyValue,"RequestPenalized",true);

}For further information: http://help.bizagi.com/bpmsuite/en/index.html?obtain_and_use_entity_values.htmRegards

I was trying to do this:CHelper.setAttrib("MyCollection", list[0].SurrogateKeyValue,"File", NewFile);But it does not work.

It is not insert file in my collection

photo
0

Dear sofya,

To check the loop of the collection, please implement traces: http://help.bizagi.com/bpmsuite/en/index.html?error_control_and_diagnostics_.htm. During the development process (automation-of-processes stage), and in the production environment, there are situations where execution needs to be traced, or debugged. Bizagi offers the possibility to trace errors in the Processes workflows (for their control and diagnose) so that administrators can validate if the business rules, validations, interfaces invocations, or even the Process needs to be tuned up.

Follow these trace, you will be able to attach the file.

Regards

photo
0

Okey, thank you very much! I will ty to do this.