Created
February 15, 2022 19:13
-
-
Save noakesey/789923163534001e5228870caee005d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExtensionOf(classStr(FormRun))] | |
public final class FormRun_Class_Extension | |
{ | |
/// <summary> | |
/// This allows unencrypted setting of the recordContext via the q querystring parameter: | |
/// q={"Parameters":[{"DataSource":"CustTable","FieldValues":[{"Field":"AccountNum","Value":"C123456789"}]}]} | |
/// </summary> | |
/// <param name = "_recordContext"></param> | |
/// <returns></returns> | |
public boolean applyRecordContext(str _recordContext) | |
{ | |
str recordContext = _recordContext; | |
//Basic check for JSON in the recordContext is assumed to be an unencrypted requestQueryParameter | |
if (strStartsWith(recordContext, '{') && strEndsWith(recordContext, '}') && strContains(recordContext, ':')) | |
{ | |
var generator = new Microsoft.Dynamics.AX.Framework.Utilities.UrlHelper.UrlGenerator(); | |
generator.EncryptRequestQuery = false; | |
generator.ParseRequestQueryParameter(_recordContext); | |
//Encrypt the requestQueryParameter and pass it on | |
generator.EncryptRequestQuery = true; | |
recordContext = generator.GenerateRequestQueryString(); | |
} | |
return next applyRecordContext(recordContext); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment