How to get the right execution context during runtime - netsuite

I'm trying to prevent a userevent script from running in case of a mass update triggering it. Pretty simple task you might think. Usually the runtime.executionContext should give me the value that I'm looking for. What I'm expecting is runtime.ContextType.CUSTOM_MASSUPDATE but I keep getting the runtime.ContextType.USEREVENT.
What I need is the value that is correctly written in the system notes for this action:
Can anyone tell me where I can get this context value during runtime?

Instead of trying to code around the context, why not change the deployment to prevent execution under Custom Mass Update ?
Locate the Deployment, move to the Context Filtering tab and scroll through the Execution Context field looking for the Custom Mass Update option and deselect it.

Related

Azure DevOps When Work Items Meet Iterations

Is there a field that exposes WHEN a work item is assigned to its current iteration?
Seems like a pretty basic thing one might like to know, but I can't seem to find it anywhere. Can someone point me in the right direction?
There is No field that exposes when a work item is assigned to its iteration.
If you want to see this value, you can go to the page of the work item.
And then click "History". What you need to find is the record of the latest iteration update.
Of course, you can also get this value through the REST API:
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{id}/updates
But just like getting it by website, you need to spend some time looking for this value, and you can't apply it to queries.
If you really need a field that exposes when a work item is assigned to its iteration. You can create a new process that inherits from your current process and change the process of your project. Click this document for detailed steps.
And then, add a new field to show the latest updates of iteration. Click this document for detailed steps.
This way you can treat the iteration change time as a real field. However, the defect is that when you make changes to an iteration, you need to manually change the value of this field.

Jira Scriptrunner - Update a parent's field when modifying the child's field

In Jira, we have a series of subtasks all belonging to a common parent task. For ease of explanation, these subtasks will referred to as such, and the parent task will be referred to as the lesson.
On each subtask, there is a field 'Percent Complete', which is manually updated by the user as progress is made on the subtask.
The lesson will also have a 'Percent Complete' field, which the user cannot manually update. Instead, I would like it to be updated through the execution of a Groovy script when a subtask's 'Percent Complete' field is updated by a user, since the lesson's Percent Complete will be comprised of the weighted sums of the child subtask's Percent Complete field.
I'm a programmer with no experience in Jira customization. The actual logic behind getting the Percent Complete value for the Lesson task is super simple, but I don't know how to 'hook everything up'. So my question is this:
How can I trigger a field in a parent task (the lesson) to be updated to a calculated value when the value of the child (subtask) field is changed?
My original thought was to create a Custom Scripted Field in the subtask, and in the groovy script which is attached, find its parent task (the lesson), and then iterate through all of its subtasks, performing the relevant calculations on the required fields and then writing the result to a custom field belonging to the parent.
Is this the right approach?
A script field is not a good approach for what you try to achieve. A script field gets evaluated and runs its script every time an issue is requested, so it would run far too often for your needs. E.g. it will also run for every issue whenever a jira reindex is performed or whenever a user looks at an issue.
Zeddzull commented with a better approach. In a script listener, you can respond to issue updated events and check which field was updated and only update your parent issue if needed.
More documentation is available here.
If you google a bit you'll also find info about how to check for changed fields or how to update a custom field.
Getting your parent issue is as simple as calling the getParentObject() on your issue instance.

Checkbox in web application automation (UIPath)

I want to automate a process in web application using UIPath. There is a check box which need to be checked everytime I want to generate report. I was trying to automate using "click" in UI automation. There is no issue on the first process.
However, the check box doesn't reset to "uncheck" after the first process is done.
So the next time I run the process again, the check box get clicked again into "uncheck" condition.
I want to create an automation to check if the check box state is "checked" or "uncheck". If the state is "checked", then I want to skip the click check box process.
What is the ideal way to do this? I imagine using workflow flow decision. But if anybody can elaborate which function I need touse. It would be a great help!
You could just use the UiPath activity Check. You can find it in Ui Automation > Element > Control. Look for the property Action and in your case choose check (default). This won't check the checkbox if its already checked.
You can use the Get Attribute activity and you'll need to identify the attribute name for the checkbox that you are looking to extract. You can then assign it's value to a variable(probably a string) and check the value and proceed accordingly. In my test case it was the "text" attribute I needed to use which brought back a value of either checked or unchecked.

"Failed to query property values" error on component in REDHAWK

My waveform initializes well on startup, but after a few seconds into processing, it pops up a red flag on the symbol on the right in the IDE's SCA Explorer tab. The tool tip says "Failed to query property values".
I believe the issue is caused by the "process" method in the component taking too long, but I need to be able to obtain a certain element of a rather long list of chunks of data, so I can process each chunk. Therefore, I need to have a property of the component be a reference to this long list of data. Is there a better way of doing this? I had created a child process to do all of this, but that sort of defeats the purpose of using REDHAWK to manage the execution.
Thanks for your time!
Ben,
The first step will be to understand exactly what error occurred. This can be done by following the steps listed here. Basically:
Window > Show View > Other ...
Select General > Properties. The properties view should now be visible
In the SCA Explorer view, select the application with the red flag symbol
Now in the Properties view, you should see two tabs "Properties", and "Advanced". In the "Advanced" tab where will be a Status field that says "Failed to query property values...". When you select this field it will show a "Details..." button. Click that to receive the stack trace for the error.
Another alternative is to use the Python Sandbox (or unittest) capabilities to start your component and attempt a query. The equivalent error will be thrown as a Python exception. You can learn about the sandbox here.
As for the second part of your question, the REDHAWK process() method is already executing as a sub-thread, so it won't block query() operations unless you have created a thread lock (or used the propertySetAccess lock within your serviceFunction). If you are using a lock, then it is possible that the query() will block until the CORBA timeout is reached. You will know if this has occurred because the stack trace will be a CORBA Timeout error.
However, you said "I need to have a property of the component be a reference to this long list of data" so I think you may be getting an error related to the maximum CORBA transfer size. You can adjust the CORBA maximum transfer size by editing /etc/omniORB.cfg so the problem goes away, but your component will cause problems for others who use it. A better option is to reconsider the design of the component. You will probably want to use BULKIO ports to transfer the data in-to and out-of your component.
If you could provide more details about the algorithm you are using or source code examples, that could provide additional information that would help isolate the root problem.

How can I get if a crm dynamics 2011 update plugin was triggered by an activate/deactivate/merge action?

I build a plugin that runs in account update message that makes some validation not to duplicate the record. But if I try to disable that account or merge with another one it triggers the plugin.
How can I tell if the plugin was triggered by an activate/deactivate/merge action, or event mode like the one in CRM Dynamics 2011 Save Event Arguments Reference?
To add to Pete Oakey's answer, you can actually tell your plugin to fire only when certain fields are changed at the registration phase, in addition to testing this in actual code # runtime, by changing the "Filtering Attributes" of the plugin step. So unless your validation logic specifically needs the StateCode/StatusCode attributes to correctly process, you can filter those two attributes out, or just include the attributes your validation logic needs.
Original answer:
I believe you can reference the IExecutionContext.Depth Property of the IPluginExecutionContext object.
Every time a running plug-in or Workflow issues a message request to
the Web services that triggers another plug-in or Workflow to execute,
the Depth property of the execution context is increased. If the depth
property increments to its maximum value within the configured time
limit, the platform considers this behavior an infinite loop and
further plug-in or Workflow execution is aborted. The maximum depth
(8) and time limit (one hour) are configurable by the Microsoft
Dynamics CRM administrator.
So you can use an if statement to check if Depth > 1.
One way would be to compare the before and after values of what's changed on the account entity in the plugin. For example if you have only have active (if that's the right property name) in the values - you can look at the after value to see what's happened.
Another way would be to add a specific plugin for these messages and set some property/flag which you can check in the update plugin. Obviously this would have to run before the update plugin.

Resources