2642
Points
Questions
19
Answers
200
-
Hi Matt,
Not sure if this change will make much of difference. m_session or session are just variable. It should work either ways as when you don’t specify IAgileSession it will case m_session to session object. It works pretty much like varchar.
I have used in either ways and it worked. So whichever approach works u need to go with that 🙂
Regards,
Arif- 3634 views
- 10 answers
- 0 votes
-
- 3634 views
- 10 answers
- 0 votes
-
Hi Mark,
Reviewed and tried running the code on my instance looks fine at the moment to me. I have edited your code. Please try now.
import com.agile.agileDSL.ScriptObj.IBaseScriptObj
import com.agile.agileDSL.ScriptObj.AgileDSLException;
import com.agile.api.*;
import java.util.*;
import com.agile.px.IEventInfo;
import com.agile.px.EventConstants;
import com.agile.px.IWFChangeStatusEventInfo;void invokeScript(IBaseScriptObj obj) {
IAgileSession session = obj.getAgileSDKSession();
IEventInfo req = obj.getPXEventInfo();
IWFChangeStatusEventInfo e = null;try {
if (req instanceof IWFChangeStatusEventInfo) {
eventInfo = (IWFChangeStatusEventInfo)req;
}
String message = “Update: Nothing to process”;
obj.logMonitor(“Now looking at Affected Items LSR and MRR”);if (eventInfo!=null) {
IDataObject dataObject = eventInfo.getDataObject();
IAgileClass relObjectClass = dataObject.getAgileClass();
if (!relObjectClass.isSubclassOf(ChangeConstants.CLASS_CHANGE_ORDERS_CLASS)){
//throw new AgileDSLException(“The PX is only applicable for Change Order”);
obj.logMonitor(“The PX is only applicable for Change Order”);
}
// Iterate through Affected Items table
ITable ai = dataObject.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
Iterator it = ai.iterator();
IRow row = null;
while(it.hasNext()) {row = (IRow)it.next();
ai_item = (IItem)row.next();String item_number = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER);
obj.logMonitor(“Item number: ” + item_number);//You can get desired change attribute value here or the base-ID
// —– LSR —–
// Affected Item TEXT12 contains the LSR (Lowest Ship Rev)
// —————
String m_value_LSR = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_TEXT12);
obj.logMonitor(“Affected Item LSR: ” + m_value_LSR);// —– MRR —–
// Affected Item TEXT14 contains the MRR (Min Repair Rev)
// —————String m_value_MRR = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_TEXT14);
obj.logMonitor(“Affected Item MRR: ” + m_value_MRR);// —– Now let’s update the item —–
IItem m_item = (IItem) session.getObject(ItemConstants.CLASS_ITEM_BASE_CLASS, item_number);// Page Two of the Item will hold the LSR (Lowest Ship Rev) in TEXT16
m_item.setValue(ItemConstants.ATT_PAGE_TWO_TEXT16, m_value_LSR);// Page Two of the Item will hold the MRR (Min Repair Rev) in TEXT20
m_item.setValue(ItemConstants.ATT_PAGE_TWO_TEXT20, m_value_MRR);
}
obj.logMonitor(“Succesfully updated the values”);
}
}
catch (Exception ex) {
ex.printStackTrace();
obj.logMonitor(“Update was not successful”);
throw new AgileDSLException(ex);
}
}Regards,
Arif- 3634 views
- 10 answers
- 0 votes
-
- 1584 views
- 2 answers
- 0 votes
-
Hi.
I assume you have already configured the event. Try using the following script in handler.
import com.agile.agileDSL.ScriptObj.IBaseScriptObj
import com.agile.agileDSL.ScriptObj.AgileDSLException;
import com.agile.api.*;
import java.util.*;
import com.agile.px.IEventInfo;
import com.agile.px.EventConstants;
import com.agile.px.IWFChangeStatusEventInfo;void invokeScript(IBaseScriptObj obj) {
IAgileSession session = obj.getAgileSDKSession();
IEventInfo req = obj.getPXEventInfo();
IWFChangeStatusEventInfo e = null;
try {
if (req instanceof IWFChangeStatusEventInfo) {
eventInfo = (IWFChangeStatusEventInfo)req;
}
String message = “Update: Nothing to process”;if (eventInfo!=null) {
IDataObject dataObject = eventInfo.getDataObject();
IAgileClass relObjectClass = dataObject.getAgileClass();
if (!relObjectClass.isSubclassOf(ChangeConstants.CLASS_CHANGE_ORDERS_CLASS)){
//throw new AgileDSLException(“The PX is only applicable for Change Order”);
}
// Iterate through Affected Items table
ITable ai = dataObject.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
Iterator it = ai.iterator();
IRow row = null;
while(it.hasNext()) {row = (IRow)it.next();
ai_item = (IItem)row.next();String item_number = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER);
//You can give get desired change attribute value here or the base-ID
String your_bom_text_attribute = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_NEW_REV);
String m_value = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_NEW_REV);
IItem m_item = (IItem) m_session.getObject(ItemConstants.CLASS_ITEM_BASE_CLASS, item_number);
m_item.setValue(ATT_PAGE_TWO_TEXT17, m_value);
//You can enter your desired page two attribute value here.}
obj.logMonitor(“Succesfully update the values”);
}
}
catch (Exception ex) {
ex.printStackTrace();
throw new AgileDSLException(ex);
}
}Regards,
Arif- 3634 views
- 10 answers
- 0 votes
-
Just sharing Issue Fix for reference of other folks
=====================================Root-Cause : It happens when root activity is deleted while it’s children are still in db.
Fix :
1. Backup database.
2. Then run below sql to make sure activity 862302 is gone(The sql should return 0 results):select * from activity where id=862302
(The Activity ID which was coming on screenshot)
.
3. Create a new project using web client, e.g.a project named ‘Testxxxx”. (Can be any name).
4. Find this Testxxxx in database and get its id, e.g:1856367 .
5. Change the id of this fakeproject to 862302 and owner to User for which the issue was coming:
update activity set owner=[id of impacted user], id=862302 where id= [id of fakeproject];
commit;
.
6. Restart agile server and try to inactivate the user, and then delete his projects.- 2248 views
- 8 answers
- 0 votes
-
Totally depends on the volume of such import. Have you tried to check what is the CPU utilization at that time. You can come-up with custom codes and schedule during off-business hours. Or if the frequency is pretty higher you can have a scheduled job running over weekend.
Generally we prefer keeping the high CPU-utilization/time-consuming jobs on weekends.
The performance is mostly impacted if too many stuck-threads are getting created. You can have an SR open with Oracle, share the A-Collect logs and they will be able to provide system specific solutions.
Regards,
Arif- 1590 views
- 1 answers
- 0 votes
-
Hi Raghu,
If you have DB Access, as mentioned by Srinivas it is the most easy and effective way of tracking error .
e.g. Select * from Event_History where Message like ‘%Error%’ order by LAST_UPD DESC or Select * from Event_History where Message like ‘%Exception%’ order by LAST_UPD DESC
You can also explore sharing the Audit information via mail based on your required filtering on the db-column value.
Regards,
Aif- 1428 views
- 3 answers
- 0 votes
-
- 1451 views
- 1 answers
- 0 votes
-
- 1647 views
- 2 answers
- 0 votes