• vasanth mohan
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
trigger BusinessName on Account( after insert, after update) {
Id AccBid = staticUtil.getRecordTypeId('Account', 'Business');
Id AccCid = staticUtil.getRecordTypeId('Account', 'Corporate');
Id ConBid = staticUtil.getRecordTypeId('Contact', 'Business');
Id ConCid = staticUtil.getRecordTypeId('Contact', 'Corporate');
if (trigger.isAfter && (trigger.isInsert || trigger.isUpdate) && CheckRecursive.runOnce() ) {
list < contact > cont = new list < contact > ();
set < Id > AccId = new set < Id > ();
for (Account ac: trigger.new) {
if (ac.RecordTypeId == AccBid || ac.RecordTypeId == AccCid) {
AccId.add(ac.Id);
}
}
list < contact > updatecontact = new list < contact > ();
list < Account > acnt = [select id, name, business_privacy_flag__c, Corporate_company_name__C, business_name__c, RecordTypeId, (select id, name, lastname, Business_name1__c, contact_Type__c, RecordTypeId, Business_Privacy_Flag__c from contacts) from account where(id In: AccId) and(RecordTypeId = : AccBid or RecordTypeId = : AccCid)];

if (!acnt.isEmpty()) {
for (Account a: acnt) {
if (a.contacts != null) {
for (Contact co: a.contacts)

if (a.Business_Privacy_Flag__c == true && (a.RecordTypeId == AccBid || a.RecordTypeId == AccCid) ) {
co.Business_Name1__c = '';
updatecontact.add(co);

} else if (a.Business_Privacy_Flag__c == false && co.Business_Privacy_Flag__c==false && a.RecordTypeId == AccBid ) {
co.Business_Name1__c = a.Business_Name__c;
updatecontact.add(co);

} else if (a.Business_Privacy_Flag__c == false && co.Business_Privacy_Flag__c== false && a.RecordTypeId == AccCid) {
co.Business_Name1__c = a.Corporate_Company_Name__c;

updatecontact.add(co);


}

}

}
if (updatecontact != null && updatecontact.size() > 0) {
if (!StaticUtil.isContactCallUpdate) {
update updatecontact;
staticutil.isContactCallUpdate=true;
}
}
}

}

}

For this trigger i cant able to get more code coverage. Only 58 % showing.
Please provide solutions .,its high priority.
Integrated Tableau with salesforce using sparkler adapter. 
Issue: Enabled status page, confiqured parameters are showing in status page but not shows Tableau Server Connection [ok]/[fail].
Please provide the solutions.

Thanks in advance
trigger BusinessName on Account( after insert, after update) {
Id AccBid = staticUtil.getRecordTypeId('Account', 'Business');
Id AccCid = staticUtil.getRecordTypeId('Account', 'Corporate');
Id ConBid = staticUtil.getRecordTypeId('Contact', 'Business');
Id ConCid = staticUtil.getRecordTypeId('Contact', 'Corporate');
if (trigger.isAfter && (trigger.isInsert || trigger.isUpdate) && CheckRecursive.runOnce() ) {
list < contact > cont = new list < contact > ();
set < Id > AccId = new set < Id > ();
for (Account ac: trigger.new) {
if (ac.RecordTypeId == AccBid || ac.RecordTypeId == AccCid) {
AccId.add(ac.Id);
}
}
list < contact > updatecontact = new list < contact > ();
list < Account > acnt = [select id, name, business_privacy_flag__c, Corporate_company_name__C, business_name__c, RecordTypeId, (select id, name, lastname, Business_name1__c, contact_Type__c, RecordTypeId, Business_Privacy_Flag__c from contacts) from account where(id In: AccId) and(RecordTypeId = : AccBid or RecordTypeId = : AccCid)];

if (!acnt.isEmpty()) {
for (Account a: acnt) {
if (a.contacts != null) {
for (Contact co: a.contacts)

if (a.Business_Privacy_Flag__c == true && (a.RecordTypeId == AccBid || a.RecordTypeId == AccCid) ) {
co.Business_Name1__c = '';
updatecontact.add(co);

} else if (a.Business_Privacy_Flag__c == false && co.Business_Privacy_Flag__c==false && a.RecordTypeId == AccBid ) {
co.Business_Name1__c = a.Business_Name__c;
updatecontact.add(co);

} else if (a.Business_Privacy_Flag__c == false && co.Business_Privacy_Flag__c== false && a.RecordTypeId == AccCid) {
co.Business_Name1__c = a.Corporate_Company_Name__c;

updatecontact.add(co);


}

}

}
if (updatecontact != null && updatecontact.size() > 0) {
if (!StaticUtil.isContactCallUpdate) {
update updatecontact;
staticutil.isContactCallUpdate=true;
}
}
}

}

}

For this trigger i cant able to get more code coverage. Only 58 % showing.
Please provide solutions .,its high priority.