Anveo Web Portal / Customize the User Interface / ACF Management Codeunit

ACF Management Codeunit

Using the codeunit ACF Management you have the ability to invoke the main control functions of the Anveo Client Suite and use in their code.

The web services utilized for communication with Dynamics do not permit any interaction with the user in the Anveo Web Portal due to technical reasons. As a result, the Dynamics functions MESSAGE, CONFIRM, STRMENU and DIALOG are not automatically identified and displayed in the client. On the other hand, these predefined constraints stipulated by the web services can be circumvented with little effort by transferring these invocations to the codeunit ACF Management. The codeunit makes the case differentiation between Dynamics Client and Anveo Client Suite automatically and processes the case accordingly.

Error messages caused by ERROR do not have to be adapted, the web service can handle these.

MESSAGE …MESSAGE10 

The function MESSAGE is equivalent to the same function in Dynamics. You can use messages, in which you replace the code:

MESSAGE('Hello World!');
MESSAGE('Hello %1!', anyVariable);

with this code:

ACFManagement.MESSAGE('Hello World!');
ACFManagement.MESSAGE1('Hello %1!', anyVariable);

The function MESSAGE1 means that it contains a parameter that is embedded in the message box text. By activating the functions MESSAGE …MESSAGE10 you can specify up to 10 parameters.

CONFIRM ... CONFIRM10

In the event that you require interaction with the user via a CONFIRM message, then you can replace the code:

IF CONFIRM('Are you sure?') THEN doSomething();
IF CONFIRM('Do you want to delete %1?',anyVariable) THEN
doSomething();

with this code:

IF ACFManagement.CONFIRM('Are you sure?',TRUE) THEN
doSomething();
IF ACFManagement.CONFIRM1('Do you want to delete %1?',FALSE,
anyVariable) THEN
doSomething();

Analogous to the messages, by activating CONFIRM ... CONFIRM10 you can specify up to 10 parameters. Please note that you have to specify the parameter Default, that parameter can be omitted in the CONFIRM of Dynamics.

As with the Dynamics default version, with a CONFIRM attention should be paid that no table has been blocked in advance with INSERT, MODIFY, DELETE or LOCKTABLE, because the table is not released until the user re- registers. This, in turn, means that a very long blocking is going to restrict the work of other application users. If such a case is unavoidably necessary and has thus occurred deliberately or accidentally, a user session in Web User Setup allows it to be reset so that the processing is aborted.

STRMENU

In the event that a “Yes” or “No” is not sufficient as interaction with a CONFIRM message, you can replace the code:

Selection := Dialog.STRMENU('Yes,No,Cancel',2,'Save?');

with this code:

Selection := ACFManagement.STRMENU('Yes,No,Cancel',2,'Save?');
DIALOGOPEN, DIALOGUPDATE, DIALOGCLOSE

The functions of codeunit ACF Management are analogous to the same functions in Dynamics and are used in order to have the status of long processes (e.g. postings) shown. An example for using dialogs is found in the codeunit ACF Events Admin/Examples, function
OnAction_EXAMPLE(), action code EXAMPLE:PROGRESSW.

HYPERLINK

Equivalent to the function HYPERLINK from Dynamics.

OpenURL

Opens a Anveo Page with the contents of the specified URL.

OpenURLExtended

Opens a Anveo Page with the contents of the specified URL which allows a much longerURL than the function OpenURLExtended (find further information here).

OpenGoogleMaps

Opens a web page showing a Google-maps map at the specified address. For an example see action code CONTACT:OPENGM in the codeunit
ACF Events Sales & Marketing.

OpenWebPage

Opens a specified Anveo Page in the web client.

OpenWebPageNewRec

Opens a specified Anveo Page in the web client for inserting a new record. Once the Anveo Page is open, the record is created.

CloseWebPage

Closes the current Anveo Page in the web client.

WebPageNewRec

Creates a new record in the current Anveo Page. This function equals to the action NEW_RECORD() of codeunit ACF Events (see more informationhere).

ReloadWebPage

Reloads the current Anveo Page in the web client.

ReloadWebPagesTableNo

Reloads all opened Anveo Pages that refer to the table bearing the number indicated. The second parameter of this function sets the scope: 0 = all card, 1 = all lists, 2 = all cards and lists.

DownloadDialogWin

Opens a dialog for downloading files or for direct viewing PDF documents, provided that an appropriate browser plug-in is installed.

OpenFileDownloadDialogWinSave

Opens a dialog for downloading files, regardless of whether it could be displayed directly in the browser plugin or not.

OpenFileUploadDialogWin

Opens a dialog to upload files. The first parameter of the function returns the file name (without path), where the uploaded file was stored. The file is located after uploading in the transfer directory of the Anveo Client Suite as set up in the Anveo Setup in the field Web Service File Transfer Folder.

GetSessionID

Returns the current session ID of the Anveo User.

GetACFUserOrUSERID

Returns either the Anveo User code or the global variable USERID of Dynamics depending on the C/AL code was called by Anveo Client Suite or by Dynamics.

GetACFUser

Returns the Anveo User code, provided this is invoked within Anveo Client Suite. Otherwise a blank value is returned.

IsACF

Returns whether the C/AL code is being invoked from the Anveo Client Framework so that different types of behavior can be enacted. Comparable to ISSERVICETIER or GUIALLOWED in Dynamics.

IsApp

Returns whether the C/AL code is being invoked from the Anveo Mobile App so that different types of behavior can be enacted. Comparable to ISSERVICETIER or GUIALLOWED in Dynamics.

Log

Writes a log entry for a given function along with an accompanying text. You can debug your C/AL code using the activated protocolling of all user inputs.

SetxRec

Since xRec is not available everywhere (see here), you can set it using the function SetxRec. Setting xRec already takes place in codeunit ACF Events.

GetxRec

Since xRec is not available everywhere (see here), you can get it using the function GetxRec. Getting xRec already takes place in codeunit ACF Events.

GetTempFileName

Creates a temporary file on the server where the web service of Dynamics is running and returns its name.

When opening Anveo Pages, the source table and relation code are handed over as the parameter instead of the destination table (as is the case in Dynamics Standard). Since the destination table is located in the specified relation and all filters (including the security filter) are set there, the Anveo Pages must be opened this way for reasons dealing with security.