-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreopen_solution.js
41 lines (33 loc) · 1.36 KB
/
reopen_solution.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function ReopenSolution(id_number, x_status){
var solution = FCSession.CreateGeneric("probdesc");
solution.AppendFilter("id_number","=",id_number);
var condition = FCSession.CreateGeneric("condition");
condition.TraverseFromParent(solution, "probdesc2condition");
solution.Query();
userId = FCSession.Item("user.id");
wipbinId = FCSession.Item("wipbin.id");
condition("condition") = 2;
condition("title") = "Open"
condition("wipbin_time") = -999;
solution("modify_stmp") = -999;
solution("x_status") = x_status;
solution.RelateByID(wipbinId, "probdesc_wip2wipbin");
solution.RelateByID(userId, "probdesc_owner2user");
var actEntry = FCSession.CreateGeneric("act_entry")
actEntry.AddNew();
actEntry("act_code") = 92021;
actEntry("entry_time") = -999;
actEntry("addnl_info") = "Status = " + x_status;
actEntry.RelateByID(FCSession.Item("user.id"), "act_entry2user");
actEntry.RelateRecords(solution, "act_entry2probdesc");
actEntry.RelateByID(FCApp.GetGbstElmRankObjid("Activity Name", 92021), "entry_name2gbst_elm");
solution.Bulk.UpdateAll();
return 0;
}
var FCApp = WScript.CreateObject('FCFLCompat.FCApplication');
FCApp.Initialize();
var FCSession = FCApp.CreateSession();
FCSession.LoginFromFCApp();
var result = ReopenSolution("41", "Approved");
WScript.Echo("result = " + result);
FCSession.Logout();