Jump to content

Resolved: Problem developing customization to set child solutions


Recommended Posts

I am building off the Propagate Status to Children customization. What I would like to do is to be able to log a solution on the parent and push it down to the children.

The hang-up I am having is with the log_solution method.

log_solution(string, uuid, string, string, string);

The change_status method used in the Propagate Status to Children customization is as follows:

change_status( object, uuid, string|nil, string, object|nil ) ;

So the problem I am having is with the method's first attribute. For change_status it is an object where I used group_leader (obtained from get_co_group) to satisfy its requirement. But with log_solution it is a string and group_leader (obtained from get_co_group) is an object and cannot be used to set a string.

I have simplified my code. I'm sure I'm having a brain fart here. But if someone can point me in the right direction i would be very appreciative.

CODE
alg::zalg_update_children_solution(...) {

//if (zset_child_f == 1) {

string c_desc, c_num, c_type, p_num, p_type, wc;

object c_dob, c_list, group_leader;

int c_count, i;

uuid login_userid;

p_num = call_req_id.ref_num;

p_type = call_req_id.type.sym;

wc = format("parent = '%s'", call_req_id);

send_wait(0, top_object(), "call_attr", "cr", "current_user_id");

login_userid = msg[0];

send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1,0);

c_count = msg[1];

c_list = msg[0];

if (c_count > 0) {

for(i=0;i< c_count;i++) {

send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);

c_dob = msg[0];

send_wait(0, c_dob, "get_attr_vals",2,"ref_num","type.sym");

c_num = msg[3];

c_type = msg[6];

c_desc = description + " (initiated from Parent " + p_type + " " + p_num + ")" ;

send_wait(0, top_object(), "get_co_group");

group_leader = msg[0];

send_wait(0, c_dob, "log_solution", group_leader, login_userid, , , );

//send_wait(0, group_leader, 'checkin');

if (msg_error()) {

logf(ERROR, "error adding solution on Child %s %s from Parent %s %s - %s", c_type, c_num, p_type, p_num, msg[0]);

} else {

logf(SIGNIFICANT, "successfully added solution on Child %s %s from Parent %s %s", c_type, c_num, p_type, p_num);

}

}

}

return;

//}

}

Link to post
Share on other sites

It's trickier then I thought, I couldn't get a 'log_solution' call when doing a 'Solution' activity with bop_logging (as I'm sure you've tried).

Have you tried to set the string to an empty one or a random value ? What's the error that you get ?

It would be nice if you figure out when this method is called and track it with bop_logging.

Link to post
Share on other sites
  • 2 weeks later...

Still no luck here. tried bop_logging spelsrvr and domsrvr and no luck with the log_solution method. Couldn't get the change_status method to appear either. This is frustrating. I know what method I need to run, I just can't figure out what values need to be passed through. Argh!

My errors:

10/23 14:42:00.78 fwddeves domsrvr            4320 ERROR        domdict.c       1053 Signature error in log_solution: arg[0] = rdDAAA(2references) with invalid type OBJECT
10/23 14:42:00.78 fwddeves spelsrvr           4632 ERROR        zDEV.spl          42 error adding solution on Child Incident 4028 from Parent Incident 4054 - Bad arguments.  Does not match signature.

Link to post
Share on other sites

See these 4 methods:

change_status( object, uuid, string|nil, object|nil );

escalate( object, uuid, string|nil, uuid, uuid, long, object|nil );

log_solution( string, uuid, string, string, string );

transfer ( object, uuid, string|nil, uuid, uuid, object|nil );

The 3 that involve updating a field on the ticket all require an object for the first argument. This object would be the ticket to be updated. The log_solution does not require an object because it is not updating the value of any field on the ticket. It is strictly creating a new Activity Log entry ONLY. I would think that the first string would likely be the persid of the ticket and one of the other strings would probably be SOLN. Anyway... just my thought process for now. I sure which I could get this figured out.

Link to post
Share on other sites

Hi Gityerfix.

Played around a bit and found the following.

log_solution may work with the following parameters:

send_wait(0, cr_obj, "log_solution",

(string) group_leader_obj,

user_uuid,

user_description,

k_tool,

session );

Parameter k_tool should always be "PDM".

Parameter session seems to be a reference to a knowledge tool session_log entry and can be empty.

Wondering that you wasn't able to trace this method. That leads to the assumption, that this method is not used anywhere.

Hope that helps.

Link to post
Share on other sites

Hmmmm... Well I took your feedback mikelm, and was finally able to get the script to run without failing. But it didn't do anything. Back to the drawing board I guess. Thank you for your feedback though.

I think what I have to go on here is that when a solution is logged that nothing gets saved back to the ticket, except maybe an updated timestamp. But I'll deal with that later. If I can create multiple Act_Log entries referencing the child tickets then I might be able to get this to work.

Link to post
Share on other sites

Well good news! I was able to update a single child. YIPPEE! I just need to play around with the code a bit to get it to cycle through all the children and make sure there are no errors. I will certainly publish an article on this when I get it finalized.

Link to post
Share on other sites

And now I can update all the children. Just one last thing to accomplish and that is updating the last_mod_dt on the ticket. Since my solution is merely adding a new Activity Log entry, no update actually occurs in the Call_Req table. As a result, the last_mod_dt is not updated. Most people could probably live with this... but I want the full package here. So stay tuned. the script should be complete soon.

Link to post
Share on other sites

from the activity log level, can you check out the ticket based upon the call_req_id, from there update the last_mod_dt to be (int) now()

I can help if you show me how to pass in the call_req_id and checkout the cr by persid. I think I've seen some of your code that does that.

send_wait(0, top_object(), "call_attr", "cr", "dob_by_persid", 0, cr_persid);

object dob;

dob = msg[0];

send_wait(0, group_leader, "checkout", dob);

last_mod_dt = (int)now();

I 'borrowed' this from how CA writes properties to the ticket but seems like it would work.

Link to post
Share on other sites

Okay. Here is the spel code to push the solution from parent to children. The zset_child_f is a webengine flag that appears as a checkbox on the solution detail page. I still can't figure out how to update the ticket with a new last_mod_dt. Any help would be appreciated.

CODE
alg::zalg_update_children_solution(...) {

if (zset_child_f == 1) {

string c_desc, c_num, c_persid, c_type, p_num, p_type, wc;

object c_dob, c_list, group_leader, act_log_table_record;

int c_count, i;

p_num = call_req_id.ref_num;

p_type = call_req_id.type.sym;

wc = format("parent = '%s'", call_req_id);

send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1,0);

c_count = msg[1];

c_list = msg[0];

if (c_count > 0) {

for(i=0;i< c_count;i++) {

send_wait(0, top_object(), "get_co_group");

group_leader = msg[0];

send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);

c_dob = msg[0];

send_wait(0, c_dob, "get_attr_vals",3,"ref_num","type.sym", "persistent_id");

c_num = msg[3];

c_type = msg[6];

c_persid = msg[9];

c_desc = description + " (initiated from Parent " + p_type + " " + p_num + ")" ;

send_wait(0, top_object(), "call_attr", "alg", "get_new_dob", NULL, NULL, group_leader);

act_log_table_record = msg[0];

act_log_table_record.action_desc = action_desc;

act_log_table_record.call_req_id = c_persid;

act_log_table_record.description = c_desc;

act_log_table_record.internal = internal;

act_log_table_record.time_spent = 0;

act_log_table_record.type = type;

send_wait(0, group_leader, "checkin");

if (msg_error()) {

logf(ERROR, "error adding solution on Child %s %s from Parent %s %s - %s", c_type, c_num, p_type, p_num, msg[0]);

} else {

logf(SIGNIFICANT, "successfully added solution on Child %s %s from Parent %s %s", c_type, c_num, p_type, p_num);

}

}

}

return;

}

}

Link to post
Share on other sites

1. Launch your Web Screen Painter.

2. Launch the Schema Designer.

3. Go to the alg (Request Activity Log) table.

4. Click the Advanced tab.

5. Enter the trigger in the Site-Defined Triggers field.

6. File > Save and Publish

7. Close Schema Designer.

8. Close Web Screen Painter.

9. Stop services.

10. Run pdm_publish command.

11. Start services.

You should reference the Modification Guide for instructions on how to use the Schema Designer. The instructions in the article assume you do.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...