The CreatorCon Call for Content is officially open! Get started here.

How to Create Problem task record on problem table with script

IbrahimVali
Tera Guru

How to Create Problem task record on problem table by using script in ATF.

I have used this method, It is creating a record in problem task table but, not able to relate with particular problem in ATF.

var tasktable = new GlideRecord ('problem_task');
tasktable.initialize();
tasktable.short_description = 'round1';
tasktable.problem = ('sys_id', current.sys_id);
tasktable.insert();

there is a field 'problem' in the problem task record write, in that I need to be get that related problem number.

Thanks.

1 ACCEPTED SOLUTION

IbrahimVali
Tera Guru

Found a correct answer:

Flow A:   1. Open, 2. Set field Values, 3. Submit (Problem record on 'problem' table);

Flow B:   1. Open, 2. Set filed Values (problem field= give the reference of problem record which is                                     submitted previously), Submit (Problem Task record on 'problem_task' table)

 Flow C:   Run test, you will get related problem number on problem task record.

 

Thanks.

View solution in original post

8 REPLIES 8

SaiRaviKiran Ak
Giga Guru

Try this:

var tasktable = new GlideRecord ('problem_task');

tasktable.addQuery('problem','current.sys_id');
tasktable.initialize();
tasktable.short_description = 'round1';
tasktable.insert();

If you are inserting problem task for a single problem record then try below code:

 

var tasktable = new GlideRecord ('problem_task');
tasktable.initialize();
tasktable.short_description = 'round1';

tasktable.problem = "give problem record sys_id here"
tasktable.insert();

I have tried this method on Scripts Background. For a single record I can be able to add. but while running ATF, it will generate new record right, that is the reason it is not able to fetch current data.

 

I tried this, but it is not working.

It will be in such a way that,

var (object)tasktable.(field name)problem = current.sys_id of current opened problem.

then it may work.

or do i need to call it from script includes?