yuuvis® RAD Q&A

0 votes
by (890 points)

Hello OS-Team,

we want to autofill a field in the indexdata of a sysdocument.
I created a script in the form of the creation situation and used the onChange Event Handler.
This works great, if the information is only on the form of the document which is created.
But we also want to use data of the parent syscontextfolder.

Is this possible?

Thanks for the help in advance.

2 Answers

0 votes
by (19.2k points)
selected by
 
Best answer

You can get the ID of the context folder by 'scope.context.id' (documentation). With this ID you can get further data by using REST-WS calls.

by (890 points)
Thank you works like a charm.
+1 vote
by (890 points)

For everyone who wants to do the same. Here is the code:

var FolderID = scope.context.id;

var myFolderType;
var myFolderID;

scope.api.dms.getObject(FolderID).then(
    function(result) {
	
	if(result.data.folderid)
	{
		myFolderID=result.data.folderid;
	}
	else
	{
		 scope.api.util.notifier.error('No Folder ID found');
	}
		
	if(result.data.FolderType)
	{
		 myFolderType=result.data.FolderType;
		
	}
	else
	{
		 scope.api.util.notifier.error('No Folder Type found');
	}

    },
    function(error) {
        scope.api.util.notifier.error(''+error, 'An error occured');
    }
);`
...