setFieldValuesFromWebService

Usable on NewEdit pages and parameter pages. Executes a Web Service Call-menu item and uses the columns returned from its @Action='finished' call to set the values of input fields whose names match the column names.

This function can only be called from a field's button javascript.

Example

JavaScript button

setFieldValuesFromWebService('PersonDetails_WsLookup', 'personalIdentityNumber={personalIdentityNumber}')

Web service call procedure

CREATE OR ALTER PROCEDURE dbo.PersonDetails_LookupWebServiceCall
	@Action                 varchar(100) = NULL,
	@PersonalIdentityNumber varchar(50)
AS
BEGIN
	/* ... */

	IF @Action = 'Finished'
	BEGIN
		/* Updates the fields FullName, HomeAddress and HomeZipCode with the fetched values. */
		SELECT
			D.FullName,
			D.HomeAddress,
			D.HomeZipCode
		FROM
			dbo.PersonDetails D
		WHERE
			D.PersonalIdentityNumber = @PersonalIdentityNumber
	END
END

Usage

setFieldValuesFromWebService(menuItemAlias)
setFieldValuesFromWebService(menuItemAlias, passingfields)
setFieldValuesFromWebService(menuItemId)
setFieldValuesFromWebService(menuItemId, passingfields)

Parameters

menuItemAlias : string

Alias of menu item to call.

menuItemId : Number

Menu item to call.

passingfields : String

Values to pass to the menu item. Formatted as a standard query string.

Example: 'ssno={ssno}&task=getinfo'