ATF - FAILURE: g_form is not defined. A valid form must have g_form defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2024 05:31 AM
In ATF while opening the ServicePortal page I'm getting the below error
FAILURE: g_form is not defined. A valid form must have g_form defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2024 05:54 AM
hi @Kri
g_form object is only available on forms and not on Service Portal pages.
In Service Portal, the equivalent object is '$sp'. This object provides methods and properties tailored for Service Portal widgets and pages, enabling you to interact with the Service Portal environment.
You would need to adjust it for Service Portal like this:
var fieldValue = $sp.getField('field_name'); // Assuming you're in a widget context
if (fieldValue === 'some_value') {
// Do something
}
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2024 01:19 AM
Hi Kri,
I did have the same issue using the step "Open a Form (SP)" with a sys_id.
I found a workaround using the step "Open Service Portal Page". The next step for field values need to be for custom UI in that case. The retrieval of the components was failing initially though because the objects were not loaded.
So here's what I did:
- place "Open a Form (SP)" in the test
- place Set Component Values (Custom UI) after that
- Retrieval of the component said it is failed - but the "Next" button is available and the objects where there
- replace "Open a Form (SP)" with "Open Service Portal Page"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2024 12:50 PM
Hi BeateN,
My req is I need to impersonate the user and should able to Open the ServicePortal Page 'X' and need to validate particular Case visible to the User or not. Once it is visible need to validate whether the User able to comment the Case or not. How I can achieve it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2024 12:17 AM
I would use those steps:
- Create User (Server) - this step can impersonate the user after created automatically
- Open Service Portal Page (Custom UI) Please see the screenshot of my previous answer - Using Portal and Page unique to your requirements, adding Query Parameters sys_id = (the sys_id of your particular case), view = (your view in service portal)m, table= (the table your case is written to - probably incident).
- Step 2 failed? Then the case is not visible to the user
- Set Component Values (Custom UI) - Retrieve Components, look for the comment section, enter your value - please see screenshot from my previous answer)
- Step 4 failed? Then the user is not able to enter a comment.
Hope this helps.
Best regards,
Beate