Solved

Using CreateAndImportDocument.svc/CreateDocument to create new revision

  • 27 June 2022
  • 2 replies
  • 169 views

Userlevel 4
Badge +8

Background: Create new documents works fine using CreateAndImportDocument.svc/CreateDocument, but we often want to create a new revision (in order to keep history intact).

Challenge: When we are invoking CreateAndImportDocument.svc/CreateDocument and supplying a new revision parameter, it doesn’t seem to accept the new revision number, e.g. payload looks as following:

{

    "DocClass": "ADDO_TEST",

    "DocNo": "1365783",

    "DocSheet": "1",

    "DocRev": "A2",

    "Title": "some test of ny revision",

    "CreateFileRef": "YES"

}

Even though the new revision does not exist, IFS Cloud throws:

    "error": {

        "code": "DB_OBJECT_EXIST",

        "message": "Resource already in use.",

        "details": [

            {

                "code": 20112,

                "message": "ORA-20112: DocTitle.DOCTITLEDOCNOEXIST: The document number 1365783 already exists."

            }

        ]

    }

 How can we go about creating new revisions in terms of integration? Any pointers is most welcome.

icon

Best answer by Mathias Dahl 3 August 2022, 14:00

View original

2 replies

Userlevel 7
Badge +30

Hi Andreas,

Uploading a file and at the same time creating a new revision, or for the matter just creating a new revision, was not on the requirement list when we made that projection. I suggest you create an idea about adding what you need such that we can look into it.

In the meantime, I would have a look at what happens under the Network tab in Chrome's developer tools to see what happens when we create a new revision from the Document Revision page. It looks like two main calls, of which I think you only need the first one:

POST https://MYSERVER/main/ifsapplications/projection/v1/DocumentRevisionHandling.svc/NewRevInfoSet

Here is the payload:

{"ApprovalUpdate":true,"CopyStruct":false,"CopyStructEnabled":false,"CopyAccess":true,"CopyFile":true,"CopyFileEnabled":true,"CopyApprRouting":false,"CopyApprRoutingEnabled":false,"CopyFieldVals":true,"CopyFieldValsEnabled":true,"DocStructsExists":false,"ShowMarkdownText":false,"DocClass":"200","DocNo":"1200826","DocSheet":"1","SrcDocRev":"A1","NewDocRev":"A2","DocRevText":"QQQQ","OldTitleRev":"A1","DocRefCount":"0","MaxListObjCons":"100"}

Not tested but that probably give you a new revision.

Then there is a call to copy the file from the previous revision to the one you just created, but I think you don't need that one.

Of course, since the is a standard projection we don't guarantee that it will not be changed, as I think has been discussed in other places. It is also not an integration projection.

Good luck!

Userlevel 4
Badge +8

thx Mr Dahl, that’s what I ended up doing - but it is u said, not guaranteed that it won’t change. 

Reply