Create Test UI button for stories
This content was last updated in 2024. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 06:52 PM
I would like to create a 'Create Test' UI button on the story form in the agile module so that you can easily create a testing task (sn_test_management_test) form the form, is this something that anyone has done? Have not had much experience with doing this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 03:19 AM
var testTask = new GlideRecord('sn_test_management_test')'
testTask.initialize();
testTask.fieldA = current.storyFieldA;
testTask.fieldB = current.storyFieldB;
testTask.fieldC = 'abc';
testTask.story = current.getUniqueValue();
testTask.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 10:31 PM
Thanks however this just creates a blank test record not asscoiated with anything? I want to be able to click the UI button (Create Test) from the story form and then it takes me to the create test form where I can create and test and then when I save it, it is associated with the story (as per screen shots)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2024 11:18 PM - edited ‎08-15-2024 11:20 PM
Hi @Scotty88 ,
On clicking the UI action, if you want to open a new tab, then add the below line to the code of the @Mark Manders .
action.setRedirectURL(action);
So, the final code would be:
var storyTest = new GlideRecord('sn_test_management_test');
storyTest.initialize();
storyTest.parent = current.getUniqueValue(); // Set the testStory Parent field to the current stroy, so that it would be associated to the story and shown in the parent list.
storyTest.short_description = current.short_description; // if you want to copy the short description of the story and push it into the test created.
storyTest.insert();
action.setRedirectURL(storyTest); // on clicking the UI action, it redirects to the new record.
If this information helps you, kindly mark it as helpful!
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 04:25 PM
So I actually need it to open on this part (see below) with the option to populate a predfined short descripion and test steps and then when I save or submit it saves the test to the parent story. I tried just updating the table name on the above script however that is not working?