cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic creation of documents with workflow

cynthia_tagger
Explorer
0 Kudos

Hello all,

I'm trying to write a workflow that opens automatic PO after approval, for some reason I can't open 1 PO with several lines and even the workflow works fine it opens a different document for each line (same vendor).

does anybody has an example of the java script for copying a document from another with workflow?

I'm using Sap Business One 9.1 but I believe any version can help me.

Thanks all,

Cynthia

Accepted Solutions (1)

Accepted Solutions (1)

cynthia_tagger
Explorer
0 Kudos

Any help someone?

Hereby my code:

var PRService = company.getBusinessService('22');

var doc = company.createDIObject('Document');

doc.setCardCode("20100000");

doc.setDocDueDate("2014-12-28"); // ("YYYY-MM-DD");

var docLines = doc.getDocumentLines();

if (docLines == null) {

    docLines = company.createDIObject('DocumentLines');

}

var docLine = company.createDIObject('DocumentLine');

docLine.setItemCode("64300003");

docLine.setQuantity(65);

docLine.setPrice(23.7);

docLines.add(docLine);

// **** Second line doesn't 

docLine.setItemCode("64300003");

docLine.setQuantity(49);

docLine.setPrice(31);

docLines.add(docLine);

doc.setDocumentLines(docLines);

PRService.add(doc);

Please Advise

cynthia_tagger
Explorer
0 Kudos

Found the problem.

0 Kudos

could you please tell me what was the problem? I'm trying to do the same but it's taking only the last value.

Answers (0)