If statement in QF-test - qf-test

I am learning QF-test and want to do a simple if statement. If I make a change on this one page it enabled an "Apply" button that I want to click if it becomes enabled.
When I check if the button is enabled this is what appears
Check boolean: enabled (true) [buttonApply=>($client)]
So I want to say something like
if 'buttonApply.enabled'=="true"
Mouse Click [buttonApply=>($client)]
but that doesn't seem to work

Well I emailed QF-test support and got this answer
Set the variable in the field 'Variable for Result'. Let's say 'CompPresence'
When you run the script , the variable 'CompPresence' will be filled with the value 'true' if the button "Apply" is enabled.
You can use the If loop like If '$(CompPresence)'==”true”

Related

Apex 5: dynamic action to set item and submit page - item unchanged

I want to set an item value with a dynamic action located on a button.
After displaying a dialog page in the "DialogClose"-Action I do a "SetValue" and "SubmitPage" in the True-branch of the action.
Problem is: the item is set but not submitted. Reloading displays the original value.
Have tried the solution showed here, but it didn't solve it for me: Apex 5 : Dynamic action set page item value
Next I was suspecting that the problem is that the region is being set to "read only" on page load. But I tried with the region not being set to read only - problem stayed the same.
Update: double checked on the "read only"-region: it does make a difference. Unsetting "read only" made id work. Seems I was a bit confused while testing ...
Here's how the dynamic action looks like:
The set-value part looks like this:
And here's the submit action:
Any ideas? Thanks!
My first guess is that your item P11_GUT_LIZ has a "Source" attribute with setting "used" at "Always, replacing any existing value in session state"
If this is not the case, I suggest you add an "After submit" process for debugging in the processing tab, showing you the value after page submit:
raise_application_error (-20001,'The value of P11_GUT_LIZ is: '||: P11_GUT_LIZ);
As written in the update to the question, problem was that the region was read-only. So the idea of setting a value and submitting it was probably flawed from the beginning. But the region has to stay read-only.
So my solution to circumvent this was to set that value inside of an automomous transaction by calling a pl/sql procedure.
Thanks for all the valueable input!

How to hide a vanilla button according to form state

I am trying to hide my SAVE vanilla button according to form state. when the form state != create the vanilla button should not display. I tried different things but nothing works:
I create a function in js that returns true if form is create state
function isHideState(){
formstate = Xrm.Page.ui.getFormType();
if(formstate == formType.create){
return true;}
else{
return false;}
}
I added a disply rule and connected it to my command that relevant to the js function :
my rule is : FormStateRule and state: Create
I connected my command to my vanilla button and yet it display even if the form is'nt in create state.
Am I missing something? it's been hours.. guidance someone?
UPDATE: to be more specific - I need the button to be seen only on create mode.
We do not need to use JavaScript here, instead of Display rule, please use Enable/Disable rule and apply the FormState rule.
Please see below image
Note: Whenever you are customizing the vanilla button (OOB Save button in your case), Make sure to start by right click the button in Ribbon workbench & click customize button/command to “retain” the OOB behavior & add your customizations on top of it.
Change this line
if(formstate = formType.create){
into
if(formstate == formType.create){
Single = is for assignment; double = is for comparison.
Update:
RibbonDiffXml follows/expects this structure in command:
<CommandDefinition
Id="String">
<EnableRules />
<DisplayRules />
<Actions />
</CommandDefinition>
There’s no direct property for rules in Button; only command can be linked.
<Button Alt="String"
Command="String"
CommandType=["General" | "OptionSelection" | "IgnoredByMenu" ]
CommandValueId="String"
Description="String"
Id="String"
Image16by16="String"
Image16by16Class="String"
Image16by16Left="Non Positive Integer"
Image16by16Top="Non Positive Integer"
Image32by32="String"
Image32by32Class="String"
Image32by32Left="String"
Image32by32Top="String"
LabelCss="String"
LabelText="String"
MenuItemId="String"
ModernCommandType=[ "ControlCommand"| "System"]
ModernImage=”String”
Sequence="1"
TemplateAlias="String"
ToolTipDescription="String"
ToolTipHelpKeyWord="String"
ToolTipImage32by32="String"
ToolTipImage32by32Class="String"
ToolTipImage32by32Left="Non Positive Integer"
ToolTipImage32by32Top="Non Positive Integer"
ToolTipShortcutKey="String"
ToolTipTitle="String"
/>
After 2013, commandbar introduction changed the behavior of Enable rule similar to Display rule. Disabled buttons using Enable rule will hide the button to utilize the space for other buttons in command bar (as there are always limitation like 7 or 9 buttons in command bar unlike Ribbon).
Enabling buttons again will act like show/hide once switched (similar to Display rule). Probably you can follow this blogpost to achieve yours.
An important thing to remember is to add the enable rule(s) to the command. This is commonly missed, someone creates an enable rule but forgets to add it to the button command.
If you forget to add enable rules to the command then the button will show on all states/stages of the form. If you forget to add the command to the button, then the button will not show up on the form.
In the ribbon editor, you can add Display and Enable rules. You can check the form type with no code. Look at this video:
https://www.youtube.com/watch?v=xyLzEAW0CJs

How to use if in applescript

I'm making a game application in AppleScript. But when I was done it said this "Expected end of line but found ":".". The code I used was
display alert "By taping ok you accept the following rules: Do not hack, do not cheat, edit komponents or download our site to your desktop! If you do not follow these rules you could get banned"
if {button returned:"OK"}
tell application "/Applications/Safari.app"
open location http://www.pipadse.wix.com/games
end tell
Can anyone help?
A couple of things. First, display alert with no buttons parameter will just display an OK button, so there's no real reason to check the result. However, if you still want to, or plan on adding additional buttons, you get the result by saving the display alert return value then testing the button returned property of the value, something like this:
set alertResult to display alert "By tapping OK you accept the following rules: Do not hack, do not cheat, edit components, or download our site to your desktop! If you do not follow these rules you could get banned."
if button returned of alertResult is "OK" then
display alert "OK was pressed"
end if
And finally, if you're using this as some form of DRM, it's pretty weak.

How do I refresh a "form element" when it is changed through a webbrowser control?

I am using VB6 (yes, I know it's 10 years old :), but it works). VB.NET answers may work as well, so if you know the answer, please answer too!
I am "manually" setting a dropdown box in a form, yet the 'webbrowser' doesn't seem to update.
Here's an example
If you notice in the form, it has a place where it asks you to fill in a state. (I.e., california, etc). It looks like a javascript/DHTML popup box in MSIE (firefox doesn't do the same, so you need to use MSIE, since that is what the webbrowser control relies on). If I 'click' on the "state" field, a popup box appears. I then can say select "CA" for california, and it updates it. (It now says "CA").
If I progrmatically do it, I would do something like:
WebBrowser1.forms(2).elements(13).value = "CA" ' (sets it to 'california')
WebBrowser1.forms(2).elements(13).item(9).selected = true (makes sure it is 'selected')
However -- within the webbrowser control -- it still appears as if nothing has changed. (In reality it has, i.e., if I submit the form it will submit the correct info), but it just doesn't "update" it.
Do you have any idea how I can do a "forced" refresh (either progrmatically or through some javascript/dhtml refresh), that will correctly then 'update' the field to show that "CA" has been selected?
Thanks very much!
The last VB version I used was VB3 so forgive my VB grammar :)
If the change event has a handler that you want to simulate
WebBrowser1.forms(2).elements(13).item(9).fireEvent ("onchange",WebBrowser1.Document.createEventObject())

Making a field unavailable to a user with javascript in MS CRM 4

I am trying to disable a field, i.e. grey it out and not allow the user to select it. To achieve this effect I am currently calling
crmForm.all.new_attribute1.disabled = true;
crmForm.all.new_attribute2.Disabled = true;
The Disable, with a capital D, makes the field grayed out but the user can still put the cursor in that field or tab to it.
The disable, with a little d, makes the field unavailable to the cursor and via tab, but gives no visual indication that it can't be interacted with.
Is there a better way to do this, one call that will achieve similar results or am I stuck having both there?
Using "Disabled" property should work.
You can try putting this code in OnLoad event of Account entity (don't forget to enable Event and Publich entity!):
crmForm.all.accountnumber.Disabled = true;
And "Account Number" will be blocked and greyed as seen in this picture:
(source: vidmar.net)
You are talking about readOnly and disabled.
A great article was posted http://customerfx.com/pages/crmdeveloper/2006/03/06/readonly-and-disabled-fields.aspx ... maybe this could help.

Resources