cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get E-form Template for a Document Type using API?

Zolt_Seregi
Confirmed Champ
Confirmed Champ
OnBase 12.0.3.626 SP3I know about App.Core.EFormTemplates property that returns a list of E-Form templates configured for the current user. But, what can I do if "Don't allow form creation" is checkmarked in (Config > Document Types > {Doc Type} > E-Form) because those e-form templates aren't returned by App.Core.EFormTemplates?Or, what if I want to find the e-form template for a specific Document Type?It would be nice if the DocumentType class had an E-FormTemplate { get; set; } but no such luck (in version 12, anyway). Also, it appears there is no way to override the "don't allow form creation" by user group.The E-forms in question, are set to not allow form creation because they are created in workflow as "sub-forms" that should not be created directly by end users.
6 REPLIES 6

Ramya_Kondeti
Star Contributor
Star Contributor

Hello Zolt,

   You cannot get E-Form template associated with the Document Type, but you can get Document Type associated with the E-Form template.

We also don't return an E-Form template if "Don't allow form creation" option is checked because doing so will defeat the purpose of that option.

 

 

 

Daniel_Wolf
Champ in-the-making
Champ in-the-making

If you have the option of using a Unity form for this sub form, you can take advantage of the fact that their permissions are more granular. With an eform, this option affects creation as well as viewing. However, with a Unity Form, you can select specific usergroups whom are allowed to see the Form in the Form list. Since selecting nobody means "everyone", I'd recommend selecting only "Manager". You can still access the template via Unity Scripts this way, but nobody will be able to see the sub form in the list of forms.

Daniel_Wolf
Champ in-the-making
Champ in-the-making

The Unity form templates are created and stored from a separate factory method and storage action compared to eforms. See here:

        private void CreateNewMemberReadyHoldForm(long docHandleNum, string ID, bool flagValue, string status, string notes)        {            OBConnect();            KeywordType ktDocHandle = core.KeywordTypes.Find("Document Handle");            KeywordType ktGroupNum = core.KeywordTypes.Find("Group#");            KeywordType ktStatus = core.KeywordTypes.Find("Status");            KeywordType ktNotes = core.KeywordTypes.Find("Notes");            Keyword kwDocHandle = ktDocHandle.CreateKeyword(docHandleNum);            Keyword kwGroupNum = ktGroupNum.CreateKeyword(ID);            Keyword kwStatus = ktStatus.CreateKeyword(status);            Keyword kwNotes = ktNotes.CreateKeyword(notes);            DocumentType dt = core.DocumentTypes.Find("PRM - Member Ready Hold");            //FileType fileType = app.Core.FileTypes.Find("Electronic Form");//for Eforms            FormTemplate template = core.UnityFormTemplates.Find(x => x.Name == "PRM Member Ready Hold"); //Unity Form Template            StoreNewUnityFormProperties newFormProps =                core.Storage.CreateStoreNewUnityFormProperties(template);            newFormProps.AddKeyword(kwDocHandle);            newFormProps.AddKeyword(kwGroupNum);            newFormProps.AddKeyword(kwStatus);            newFormProps.AddKeyword(kwNotes);            newFormProps.ExpandKeysets = true;            core.Storage.StoreNewUnityForm(newFormProps);            OBDisconnect();        }

Daniel_Wolf
Champ in-the-making
Champ in-the-making

One more thing... in case you edit templates for eforms a lot and are like me (preferring usually to use an open toolbox of queries than click buttons), this will connect your eforms (doctype to active template doc and the doc handle)...

select a.doctype_num, a.doctype, a.doc_handle, a.eformfrom  (  select     idata.itemnum as doc_handle,    dtype.itemtypenum as doctype_num,    trim(dtype.itemtypename) as doctype,    trim(idata.itemname)     as eform,    rank() over ( partition by eform.itemtypenum                  order by eform.itrevnum desc)                             as rank,    eform.itrevnum           as revision,    decode(idata.status,16,'Yes','No')                                        as deleted  from hsi.itemdata idata    join hsi.dtelectronicform eform      on eform.formitemnum = idata.itemnum    join hsi.doctype dtype      on dtype.itemtypenum = eform.itemtypenum  order by dtype.itemtypenum  ) awhere a.rank = 1  and a.deleted = 'No'order by a.doctype  ;
Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.