How to invoke the action "Cancel Request" from the Requests page? - acumatica

I've tried looking for the action definition in the page's graph without any results. There are no public PXActions associated to that button.
When the graph is instantiated, Visual Studio's intellisense does not show any references to that action or to a linked method.
This is occurring in different Acumatica versions.
There are also no references to the inclusion of this button in the Actions dropdown with the AddMenuAction() method
I find it odd that this particular action would be hidden.
Thanks!

Some actions in Acumatica may exist only in the "Automation Steps" (SM205000) definition. You will not find such actions somewhere in the code. If you are asking about "Requests" (RQ301000) screen - you will find "Cancel Request" action there, which includes several steps:
Set RQRequest.Rejected = true
Set RQRequest.Status = "L" (Canceled)
Document.View.RequestRefresh() (not sure you really need this)
Save.Press()
There are 2 possible ways to invoke the action
Call PXAutomation.ApplyAction(graph, graph.Actions["Action"], "Cancel Request", row, out rollback); where graph - is your RQRequestEntry graph instance, row - RQRequest object
Manually call all steps from the code (RQRequest.Rejected = true, RQRequest.Status = "L", Save.Press())
screenshot

Related

Select a check box in Blueprism

I need to select a check box as shown in below image. I tried giving "Set Checked" on Navigate stage but it didn't seem to work.
When i try to capture the Checkbox element using HTML Mode, it is getting captured as a HTML Element and not HTML Checkbox.
Can anyone help me here please.
In my projects, a lot of times it was possible to use action "Write", and write value "True" to this element.
If not, then it should be possible to change the element type directly in the Application Modeler. Please inspect first your element, and then change these two parameters:
Element type = "HTML Check Box"
Data Type = "Flag"
Afterwards, in "Navigation" stage, there should be an action "Set checked" available.
For reference, I was able to inspect the logo from w3schools.com and mark it as checkbox in BluePrism.
Just take your datatype as 'Text' and set it to click centre in navigation.
While running the step it will set it checked and proceed it further.
When you use the "Set Checked" action as part of a Navigate stage, you have to set the "Checked" parameter in the lower portion of the Stage Properties window to "True".
Identify the required check box in Active Accessibility SPY Mode. The element Type for this will be Check Box(AA), Change it to Active Accessibility from the drop down. And then use this element in Navigate stage and select "Global Mouse Click Center" in the Actions drop down, to Check this check box

Where exactly are dialog text, OK button, and Cancel buttons defined or inherited from in CodenameOne?

Where exactly are 1) dialog 'text', 2) dialog 'OK' button, and 3) dialog 'Cancel' button defined or inherited from in CodenameOne?
Where can I see the code which instructs a dialog to be made of those components? Can someone direct me to the base class, method, etc. where each of those 3 items are defined?
I am referring to a Dialog meaning com.codename1.ui.Dialog.
Thanks
I suggest asking "how to do something" rather than "where something exists" as the answer to the latter might lead you to the wrong place.
E.g. in this case these things don't exist. All the static show methods in the Dialog eventually call into this uber method:
https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/ui/Dialog.java#L904-L940
You will notice that it constructs the components dynamically to create the dialog and doesn't provide the means to manipulate said components as the Dialog is static methods are meant to be very simple stateless tools.

Cognos 10 Report Studio: On Page Prompts & Performance

I have a report page which displays a crosstab. This is filtered by 5 paramaters. These paramaters are submitted by the user through on page checkbox prompts.
The requirement is to return the data with all values in all paramaters selected on the first run. If I leave default selections blank this behaviour is achieved but all the checkboxes are unchecked which gives misleading feedback to the user.
As an alternative I've manually specified all the values in default selections. However, this has a performance impact.
Does anyone have any alternative suggestions?
I've been looking for a way to specifically link a reprompt button to a value list so only those paramaters are resubmitted (rather than the whole page) but haven't found anything yet.
Thanks in advance - even if the answer is 'no and this is a bad way to go about it'!
One option is to use JavaScript to check all of the checkboxes after the page is rendered with no filtering applied. To do this all filters have to be set to optional. The page is rendered with all data and unchecked checkboxes. The JavaScript fires and checks all checkboxes so that the state of the prompts matches the state of the data. This happens so fast the user likely won't know the boxes weren't checked initially. A reprompt button will, when clicked, enforce whatever choices the user makes after that.
Since version 10.2, Cognos has provided a fairly simple JavaScript API to allow for render-time manipulation of prompt controls. Hopefully, you are working with 10.2 or later otherwise the code provided will not work. Here is a bit of JavaScript code that will loop through all prompts and select all values within them:
var report = cognos.Report.getReport("_THIS_");
var prompts = report.prompt.getControls();
if (typeof firstrun == "undefined") {
var values;
for (var i=0;i<prompts.length;i++) {
values = prompts[i].getValues(true);
prompts[i].addValues(values);
}
var firstrun = false;
}
Notes:
All value prompts behave the same way regarding the 10.2+ JavaScript Prompt API. It doesn't matter whether you choose a drop-down, list, checkbox or radio button interface. The way we code for all of these variations is the same. The provided code would work just as well with a list as it would with checkboxes.
Make sure that you wrap your code in script tags and that the HTML Item object you place on your page to hold the code appears below all prompt controls. If it is placed elsewhere it will not be able to find the prompt controls as they will not have been rendered when the code executes.
The code assumes that the only prompts on the page are the checkboxes you want checked. If there are other prompts on the page then you will have to target individual prompts using the getControlByName() function provided in the API rather than looping through all prompts. More information on the Cognos JavaScript Prompt API can be found here.
The key bits of code here are the getValues() and addValues() Cognos JavaScript Prompt API functions. getValues(true) returns a JSON-formatted object representing all values, selected or not, from a value prompt. addValues(values) takes a JSON-formatted object representing the values to be selected and selects them. Thus, it's a matter of grabbing all values and then passing them in to be selected.
The reason for the if block is that we only want this code to run once at first page render. When the user first runs the report we want all checkboxes checked but after that we want the checkboxes to retain state. If we didn't use the if block the user's choices would be overwritten after a reprompt. For more information on this technique check out this tutorial on my blog: JavaScript: Running Code Only Once.
Addendum
If you don't want any filters to be applied when all boxes are checked in a section even after subsequent reprompts you can do so by tweaking your filter.
Assume that we are checking against a model based item [Item1]. We have a current filter of: [Item1] in ?parameter1?. We also have four checkboxes with values of 'Choice1','Choice2','Choice3', and 'Choice4'.
The following modified filter will only apply the checkboxes to the filter when all four aren't checked:
(
'Choice1' in ?parameter1?
AND
'Choice2' in ?parameter1?
AND
'Choice3' in ?parameter1?
AND
'Choice4' in ?parameter1?
)
OR
[Item1] in ?parameter1?
If all four checkboxes are checked then the first part of the OR is satisfied and all rows will be returned. It should be fast too because most languages, including iterations of SQL, will not test the second component of an OR if the first component is satisfied.

How do I read the value of context menu checkbox?

I'm trying to create a Chrome extension that a user might want to frequently enable/disable. To facilitate this, I'd like to add a checkbox to the context menu that basically says "extension enabled". When a page loads, it would check to see if there was a check by the context menu item. I have created the menu item, and it stays persistent throughout page loads, but I don't know how to read its value. Can anyone help me out?
Here is the code that I'm using to add the checkbox to the context menu.
var checkbox1 = chrome.contextMenus.create({
"title": "Enable",
"type": "checkbox",
"onclick":enableAutofilter
});
From the Chrome docs, it appears that there is no way to read information about a context menu item. There are create, update, and remove functions, but no read function (so it has only three of the CRUD operators). This means that you'll have to maintain the on/off state elsewhere, e.g., on your background page and/or in localStorage, and toggle it when you fire enableAutoFilter.

Validating/ed events not firing in class library windows form

I'm developing a Word 2010 add in using Visual Studio 2010, and C#.
I've created a simple form, with two textboxes, and an Ok button.
The Ok button's Causes validation property is set to true.
Both textboxes CausesValidation property is set to false, and their Validating and Validated properties are set. This is so that they are only validated when the Ok button is clicked, and not when focus is changed.
If the form code is defined within the Word add in, the validating and validated events run as expected - when the Ok button is clicked. I wanted to make the form reusable, so I moved the form into a separate class library. The form largely works as expected but the validating and validated events never run with the above configuration.
Does anybody know why this is the case? Is it a bug?
It seems that you can get things working if you:
1) Set the AutoValidate property of the base form to Disable.
2) Set the CausesValidation property on the textbox to true.
3) Call the this.ValidateChildren() method in the button click.

Resources