SoftadminSnippet.WebApp_Install_Init

Type: Stored procedure

Allows the application's web app to be installed from the snippet page.

Requires that SoftadminSnippet.WebApp_Install_Button has been called.

Example

SELECT
	@InstructionIdJson = '[' + STRING_AGG('"' + I.Id + '"', ',') + ']'
FROM
	(VALUES
		(@InstallButtonContainerId),
		(@AndroidInstructionsId),
		(@IosInstructionsId),
		(@GeneralInstructionsId)
	) I(Id);

SELECT
'function showInstructions(deviceType, showInstallButton) {
	if (showInstallButton) {
		showSingleInstruction("' + @InstallButtonContainerId + '");
		return;
	}

	if (deviceType === "ios") {
		showSingleInstruction("' + @IosInstructionsId + '");
	} else if (deviceType === "android") {
		showSingleInstruction("' + @AndroidInstructionsId + '");
	} else {
		showSingleInstruction("' + @GeneralInstructionsId + '");
	}
}

function showSingleInstruction(htmlId){
	for (let currentId of ' + @InstructionIdJson + '){
		if (currentId === htmlId){
			document.getElementById(currentId).style.display = "block";
		} else {
			document.getElementById(currentId).style.display = "none";
		}
	}
}' AS JavaScript;

EXEC SoftadminSnippet.WebApp_Install_Init
	@ApplicationUrl =  'https://path.com/Softadmin',
	@LanguageId = 1,
	@InstructionsCallbackJavaScriptFunctionName = 'showInstructions';

Parameters

@ApplicationUrl mandatory varchar(500)
Url of the Softadmin application, not the snippet application. Used to retrieve the WebApp configuration file.
@LanguageId mandatory int
The language ID of the web app configuration to install. It is used to set the name of the application, corresponding to the Sa.ApplicationName phrase.
@InstructionsCallbackJavaScriptFunctionName optional varchar(300)
Name of the JavaScript function that is called to show and hide instructions, the function must be defined with the following signature:

(deviceType, showInstallButton)

Where:
- deviceType: 'ios' | 'android' | 'desktop'
- showInstallButton: boolean