Monday 29 July 2013

Migration Manager Fails when Required=1 and Default Value is blank

Purpose: The purpose of this post is to explain one of the reason for which MM package deployment fails.


Issue: I experienced myself when I was migrating database configuration attributes through MM package. MM package failed during deployment and we were getting an error "Required Fields are Blank". Initially, I couldn't find out the root cause but after some struggle, I found out that few fields in Database configuration are "Required=1" and "Default Value" is blank. 


Work Around: Entered some dummy values in "Default Value" and again created the package and was able to successfully deploy the package in Target sever. After successful deployment removed the dummy default values. 

The above procedure will be helpful, if you have few custom fields but this will not help if you have many custom fields.

Hence, I recommended it is very important to plan the migration procedure during planning phase. 


Thursday 25 July 2013

Delete Workflow History for Inactive Records


Purpose: As years pass by, the database size increases and you would like to delete unwanted records especially workflow history. This document explains you how to delete workflow history.

To delete the workflow history, execute the below scripts:

delete
from wftransaction
where wfid not in
(
  select wfid
  from wfinstance
  where active = 1
)
  and transdate <= (current timestamp - 1 month)
  and memo is null;
commit;

delete
from wfcallstack
where wfid in
(
  select wt.wfid
  from wftransaction wt
    ,wfinstance wi
  where wt.wfid = wi.wfid
    and wi.active = 0
    and transdate <= (current timestamp - 1 month)
    and memo is null
);
commit;

delete
from wfassignment
where wfid in
(
  select wt.wfid
  from wftransaction wt
    ,wfinstance wi
  where wt.wfid = wi.wfid
    and wi.active = 0
    and transdate <= (current timestamp - 1 month)
    and memo is null
);
commit;

delete
from wfinstance
where wfid in
(
  select wfid
  from wftransaction
  where memo is null
    and transdate <= (current timestamp - 1 month)
)
  and active = 0;
commit;

delete
from logintracking
where attemptdate <= (current timestamp - 3 month);
commit;