简体   繁体   English

检查参数是否已在USD数据参数中创建

[英]Check if the Parameter has been created inside USD Data Parameters

I am trying to built a logic where I am running an action call with uii action CreateEntity . 我试图建立一个逻辑,在其中使用uii action CreateEntity运行一个动作调用。 The action call creates a record in CRM Custom Entity. 该操作调用在CRM自定义实体中创建一条记录。 Now, the action call is being fired multiple times and that is because it is attached in the BrowserDocumentComplete Event which is being fired multiple times. 现在,该动作调用被多次触发,这是因为该动作调用已附加在被多次触发的BrowserDocumentComplete事件中。

Now since that action call is being fired multiple times therefore multiple records are being created inside CRM. 现在,由于该操作调用被多次触发,因此在CRM内创建了多个记录。 I want to make it stop after it creates the first record and what happens is if it creates a first record a parameter is created inside USD DataParameters. 我想让它在创建第一条记录后停止,然后发生的情况是,如果创建第一条记录,则在USD DataParameters内​​部创建一个参数。

So, I want to check through Scriptlet preferably that if the parameter lets name it RecordCreated has been created inside USD then make the action call stop. 因此,我希望最好通过Scriptlet进行检查,如果该参数让其命名为RecordCreated ,则已在USD内创建了该参数,则使操作调用停止。

Something like this if (RecordCreated Exists) then stop else run if (RecordCreated Exists) then stop else run

Ideally BrowserDocumentComplete event won't get triggered multiple times in USD. 理想情况下,不会以美元多次触发BrowserDocumentComplete事件。 Is it the PageLoadComplete event normally gets triggered twice. 是PageLoadComplete事件通常被触发两次。 That is something which you need to check once before thinking of another solution. 在考虑其他解决方案之前,您需要检查一下。

Coming to your issue, if the browser document complete is not working as expected in your case, another option is to do a check whether the record is created before running the action call the second time. 关于您的问题,如果浏览器文档的完整性无法按照您的情况运行,则另一个选择是在第二次运行操作调用之前检查是否已创建记录。 For that what you can do is, whenever an action call is executed you will get an object $Result in the USD data parameters. 为此,您可以做的是,每执行一次操作调用,您都会在USD数据参数中获得一个对象$ Result。 Look for the object and get the guid of the CRM record being created. 查找对象并获取要创建的CRM记录的向导。 You should be able to access that something like this, 您应该可以访问类似这样的内容,

$Result.<<Name of your action call goes here>>

In your same action call, check whether the output of the above code and see whether that is empty of a GUID. 在您的同一操作调用中,检查以上代码的输出是否正确,并查看GUID是否为空。 If its not empty that means your action call was executed previously, otherwise execute the action call to create the record. 如果其不为空,则意味着您的操作调用先前已执行,否则执行该操作调用以创建记录。

Hope that helps. 希望能有所帮助。

I believe that BrowserDocumentComplete fires each time either a page or an iframe finishes loading. 我相信,每次页面或iframe加载完成时都会触发BrowserDocumentComplete。 Instead, use an event that generally only fires once, like DataReady or PageReady. 而是使用通常仅触发一次的事件,例如DataReady或PageReady。 This assumes that DataReady and PageReady are available in your version of USD. 假设您的美元版本中提供了DataReady和PageReady。

DataReady and PageReady can still fire multiple times during reload / refresh scenarios, so you can still have the same problem. 在重新加载/刷新方案期间,DataReady和PageReady仍然可以多次触发,因此您仍然可能遇到相同的问题。 To mitigate this, check for the existence of the data parameter that is created when the record is created. 为了减轻这种情况,请检查是否存在创建记录时创建的数据参数。 In the condition check, allow the replacement parameter to be replaced by an empty string when it doesn't exist, using the '+' modifier. 在条件检查中,使用'+'修饰符,允许将替换参数替换为不存在的空字符串。 If your Action Call is named "Create Custom Entity Record", then your condition expression will probably look something like this: 如果您的操作调用被命名为“创建自定义实体记录”,那么您的条件表达式可能看起来像这样:

[[$Result.Create Custom Entity Record]+]===""

Now, even if the Action Call is attempted multiple times, it should only fire once and be prevented from firing subsequently. 现在,即使多次尝试执行操作调用,也应仅触发一次并防止其随后触发。 Subsequent attempts should be shaded yellow in Debugger, indicating "ConditionFailed". 后续尝试在Debugger中应显示为黄色,指示“ ConditionFailed”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM