-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
3Replies
Formula field is returning for all record types created date + 3 working days , please help for the below formula
I have written the below formula field to add the number of working days to the created date for diffrent record types , but it is adding 3 business days to all scenarios.
IF(RecordType.DeveloperName ="Request_for_Data",CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 3),
IF(RecordType.DeveloperName ="Network_Information_Request", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 6),
IF(RecordType.DeveloperName ="Network_Analysis_Request", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),
IF(RecordType.DeveloperName ="Network_Analsysis_Adding_New_Employees_Divisions", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),
IF(RecordType.DeveloperName = "Network_Options_Due_to_Provider_Termination",
CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),null)
)
)
)
)
IF(RecordType.DeveloperName ="Request_for_Data",CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 3),
IF(RecordType.DeveloperName ="Network_Information_Request", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 6),
IF(RecordType.DeveloperName ="Network_Analysis_Request", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),
IF(RecordType.DeveloperName ="Network_Analsysis_Adding_New_Employees_Divisions", CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),
IF(RecordType.DeveloperName = "Network_Options_Due_to_Provider_Termination",
CASE(
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ),
3, CreatedDate + 2 + 3,
4, CreatedDate + 2 + 3,
5, CreatedDate + 2 + 3,
6, CreatedDate + 1 + 3,
CreatedDate + 8),null)
)
)
)
)
-
- Padtalluri
- February 11, 2016
- Like
- 0
- Continue reading or reply
Help !!! Test Class giving error
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactId]: [ContactId]
-
- Padtalluri
- February 07, 2016
- Like
- 0
- Continue reading or reply
Apex trigger not firing - update fields from custom object to Account Object
trigger AlertTrigger on Alert__c (after update) {
System.debug('@@@@@@@@@@@');
List<Account> acctlist = new List<Account>();
Set<Id> acid = new Set<Id>();
for(Alert__c ab:Trigger.New) {
acid.add(ab.Account__c);
system.debug('&&&&&&&&'+acid);
}
Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
Set<Account> a = new Set<Account>();
for(Alert__c b : Trigger.new){
if(acct.containsKey(b.Account__c)) {
If(b.Type__c == 'New Client')
{
Account upd = acct.get(b.Account__c);
If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker')
{
upd.Effective_Date__c = b.Effective_Date__c;
upd.Aetna_Region__c = b.Region__c;
a.add(upd);
}
}
}
}
acctlist.addAll(a);
update acctlist;
}
System.debug('@@@@@@@@@@@');
List<Account> acctlist = new List<Account>();
Set<Id> acid = new Set<Id>();
for(Alert__c ab:Trigger.New) {
acid.add(ab.Account__c);
system.debug('&&&&&&&&'+acid);
}
Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
Set<Account> a = new Set<Account>();
for(Alert__c b : Trigger.new){
if(acct.containsKey(b.Account__c)) {
If(b.Type__c == 'New Client')
{
Account upd = acct.get(b.Account__c);
If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker')
{
upd.Effective_Date__c = b.Effective_Date__c;
upd.Aetna_Region__c = b.Region__c;
a.add(upd);
}
}
}
}
acctlist.addAll(a);
update acctlist;
}
-
- Padtalluri
- January 29, 2016
- Like
- 0
- Continue reading or reply
Help !!! Test Class giving error
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactId]: [ContactId]
- Padtalluri
- February 07, 2016
- Like
- 0
- Continue reading or reply
Apex trigger not firing - update fields from custom object to Account Object
trigger AlertTrigger on Alert__c (after update) {
System.debug('@@@@@@@@@@@');
List<Account> acctlist = new List<Account>();
Set<Id> acid = new Set<Id>();
for(Alert__c ab:Trigger.New) {
acid.add(ab.Account__c);
system.debug('&&&&&&&&'+acid);
}
Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
Set<Account> a = new Set<Account>();
for(Alert__c b : Trigger.new){
if(acct.containsKey(b.Account__c)) {
If(b.Type__c == 'New Client')
{
Account upd = acct.get(b.Account__c);
If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker')
{
upd.Effective_Date__c = b.Effective_Date__c;
upd.Aetna_Region__c = b.Region__c;
a.add(upd);
}
}
}
}
acctlist.addAll(a);
update acctlist;
}
System.debug('@@@@@@@@@@@');
List<Account> acctlist = new List<Account>();
Set<Id> acid = new Set<Id>();
for(Alert__c ab:Trigger.New) {
acid.add(ab.Account__c);
system.debug('&&&&&&&&'+acid);
}
Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
Set<Account> a = new Set<Account>();
for(Alert__c b : Trigger.new){
if(acct.containsKey(b.Account__c)) {
If(b.Type__c == 'New Client')
{
Account upd = acct.get(b.Account__c);
If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker')
{
upd.Effective_Date__c = b.Effective_Date__c;
upd.Aetna_Region__c = b.Region__c;
a.add(upd);
}
}
}
}
acctlist.addAll(a);
update acctlist;
}
- Padtalluri
- January 29, 2016
- Like
- 0
- Continue reading or reply