-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
8Replies
Test coverage Help
A consultant wrote a Opportunity Trigger but no code coverage. Any help with developing a test class would be appreciated, so I could deploy the Trigger below to production.
trigger Opp_Trigger on Opportunity (after insert, after update) { if ((!Util.DoNotRunTrigger) && (Trigger.IsAfter) && (!Archtics.HasSentArchticsCreate)) { /* create in Archtics */ set<Id> accids = new set<Id>(); set<Id> ownerids = new set<Id>(); for (Opportunity o : Trigger.new) { Opportunity oldopp; if (Trigger.IsUpdate) oldopp = Trigger.oldmap.get(o.Id); accids.add(o.AccountId); ownerids.add(o.OwnerId); } map<Id, Account> accid2accmap = new map<Id, Account>(); if (accids.size() > 0) { accid2accmap = new map<Id, Account>([select Id, Update_in_Archtics_Wizards__c, Update_in_Archtics_Mystics__c, Update_in_Archtics_Capitals__c, Update_in_Archtics_MSE__c, Create_in_Archtics_Wizards__c, Create_in_Archtics_Mystics__c, Create_in_Archtics_Capitals__c,Create_in_Archtics_MSE__c, Acct_Rep_ID_Capitals__c, Acct_Rep_ID_Mystics__c, Acct_Rep_ID_Wizards__c, Archtics_ID_Wizards__c, Archtics_ID_Mystics__c, Archtics_ID_Caps__c,Archtics_ID_MSE__c from Account where Id in :accids]); } map<Id, User> userid2usermap = new map<Id, User>(); if (ownerids.size() > 0) { userid2usermap = new map<Id, User>([ select Id, Archtics_Rep_ID_Wiz__c, Archtics_Rep_ID_Mystics__c, Archtics_Rep_ID_Caps__c from User where Id in :ownerids]); } // set<Id> capitalsaccids = new set<Id>(); //set<Id> mysticsaccids = new set<Id>(); // set<Id> wizardsaccids = new set<Id>(); set<Id> MSEaccids = new set<Id>(); for (Opportunity o : Trigger.new) { if ((!o.Name.contains('Auto-created Opportunity')) && (o.Product_Category__c != null)) { if (o.Product_Category__c.contains('Caps')) { system.debug('\n\n42 caps found'); Account thisacc = accid2accmap.get(o.AccountID); if ( (thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') || (o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Capitals__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Caps__c; accid2accmap.put(o.AccountId, thisacc); //capitalsaccids.add(o.AccountId); // thisacc.Acct_Rep_ID_MSE__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_MSE__c; MSEaccids.add(o.AccountId); } } if ((o.Product_Category__c.contains('Wizards') || (o.Product_Category__c.contains('Valor') || (o.Product_Category__c.contains('Family Shows/Events and Concerts'))))) { Account thisacc = accid2accmap.get(o.AccountID); if ((thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') || (o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Wizards__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Wiz__c; accid2accmap.put(o.AccountId, thisacc); MSEaccids.add(o.AccountId); } } if (o.Product_Category__c.contains('Mystics')) { Account thisacc = accid2accmap.get(o.AccountID); if ((thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') ||(o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Mystics__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Mystics__c; accid2accmap.put(o.AccountId, thisacc); MSEaccids.add(o.AccountId); // mystics now created in MSE as well } } } } if (accid2accmap.size() > 0) update accid2accmap.values(); //if (capitalsaccids.size() > 0) //Archtics.createFuture(capitalsaccids, 'Capitals'); //if (wizardsaccids.size() > 0) //Archtics.createFuture(wizardsaccids, 'Wizards'); //changed from wizardsaccids to MSEaccids 130711 JN if (MSEaccids.size() > 0) Archtics.createAccountsInArchtics(MSEaccids, 'MSE'); Archtics.HasSentArchticsCreate = TRUE; } //end if IsAfter }
- Gavin Britto
- August 04, 2016
- Like
- 0
- Continue reading or reply
Format Date in Visual Force page
I need Help converting 2016-01-08T19:00:00 to 01/08/2016
I want to truncate the time (19:00:00 )
This is what I wrote:
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
That didn't work either
I want to truncate the time (19:00:00 )
This is what I wrote:
<apex:column headerValue="Event Date"> <apex:outputText value="{0,date,MM'/'dd'/'yyyy}"> <apex:param value="{!listMysticsmailMap[m].eventDateTime}" /> </apex:outputText> </apex:column>
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
<apex:outputText value="{0,date,MM/dd/yyyy}">
That didn't work either
- Gavin Britto
- April 05, 2016
- Like
- 0
- Continue reading or reply
Field Update Trigger 2
To give you some background, Contact is the parent object and Concept_Email__c is the child object.
I am trying to write a tirgger that would update the
The arctics ID which is named "Concept_email_Arctics_ID_MSE__c" on Concept_Email__c object when it is changed
Below is the code snippet that I've started. Any help with fixing the trigger below will be appreciated.
As of now I am getting a syntactical error "Invalid field contact for sObject contact"
I am trying to write a tirgger that would update the
The arctics ID which is named "Concept_email_Arctics_ID_MSE__c" on Concept_Email__c object when it is changed
Below is the code snippet that I've started. Any help with fixing the trigger below will be appreciated.
As of now I am getting a syntactical error "Invalid field contact for sObject contact"
trigger UpdateArchticIDEmail on Contact (After Update) { for(Contact cont: Trigger.New) { //Select Arctics ID from Contact__c object Contact ArchID=[select Archtics_ID__c from Contact where id=:cont.Contact]; //Select Arctics ID from Concept_Email__c object list<Concept_Email__c> cec=[select Concept_email_Arctics_ID_MSE__c from Concept_Email__c WHERE Contact=:cont.id]; List<Concept_Email__c> listemail=new List<Concept_Email__c>(); for(Concept_Email__c uid:cec) { //Assign Updated Details from Contact__c object to Concept_Email__c Object uid.Concept_email_Arctics_ID_MSE__c=ArchID.Archtics_ID__c; listemail.add(uid); } update listemail; } }
- Gavin Britto
- September 10, 2015
- Like
- 0
- Continue reading or reply
field update trigger
To give you some background, I have a parent object called Concept_Master_Contact__c and child object called Concept_Email__c
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
- Gavin Britto
- September 02, 2015
- Like
- 0
- Continue reading or reply
Test coverage Help
A consultant wrote a Opportunity Trigger but no code coverage. Any help with developing a test class would be appreciated, so I could deploy the Trigger below to production.
trigger Opp_Trigger on Opportunity (after insert, after update) { if ((!Util.DoNotRunTrigger) && (Trigger.IsAfter) && (!Archtics.HasSentArchticsCreate)) { /* create in Archtics */ set<Id> accids = new set<Id>(); set<Id> ownerids = new set<Id>(); for (Opportunity o : Trigger.new) { Opportunity oldopp; if (Trigger.IsUpdate) oldopp = Trigger.oldmap.get(o.Id); accids.add(o.AccountId); ownerids.add(o.OwnerId); } map<Id, Account> accid2accmap = new map<Id, Account>(); if (accids.size() > 0) { accid2accmap = new map<Id, Account>([select Id, Update_in_Archtics_Wizards__c, Update_in_Archtics_Mystics__c, Update_in_Archtics_Capitals__c, Update_in_Archtics_MSE__c, Create_in_Archtics_Wizards__c, Create_in_Archtics_Mystics__c, Create_in_Archtics_Capitals__c,Create_in_Archtics_MSE__c, Acct_Rep_ID_Capitals__c, Acct_Rep_ID_Mystics__c, Acct_Rep_ID_Wizards__c, Archtics_ID_Wizards__c, Archtics_ID_Mystics__c, Archtics_ID_Caps__c,Archtics_ID_MSE__c from Account where Id in :accids]); } map<Id, User> userid2usermap = new map<Id, User>(); if (ownerids.size() > 0) { userid2usermap = new map<Id, User>([ select Id, Archtics_Rep_ID_Wiz__c, Archtics_Rep_ID_Mystics__c, Archtics_Rep_ID_Caps__c from User where Id in :ownerids]); } // set<Id> capitalsaccids = new set<Id>(); //set<Id> mysticsaccids = new set<Id>(); // set<Id> wizardsaccids = new set<Id>(); set<Id> MSEaccids = new set<Id>(); for (Opportunity o : Trigger.new) { if ((!o.Name.contains('Auto-created Opportunity')) && (o.Product_Category__c != null)) { if (o.Product_Category__c.contains('Caps')) { system.debug('\n\n42 caps found'); Account thisacc = accid2accmap.get(o.AccountID); if ( (thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') || (o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Capitals__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Caps__c; accid2accmap.put(o.AccountId, thisacc); //capitalsaccids.add(o.AccountId); // thisacc.Acct_Rep_ID_MSE__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_MSE__c; MSEaccids.add(o.AccountId); } } if ((o.Product_Category__c.contains('Wizards') || (o.Product_Category__c.contains('Valor') || (o.Product_Category__c.contains('Family Shows/Events and Concerts'))))) { Account thisacc = accid2accmap.get(o.AccountID); if ((thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') || (o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Wizards__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Wiz__c; accid2accmap.put(o.AccountId, thisacc); MSEaccids.add(o.AccountId); } } if (o.Product_Category__c.contains('Mystics')) { Account thisacc = accid2accmap.get(o.AccountID); if ((thisacc != null) && (thisacc.Archtics_ID_MSE__c == null) && ( (o.StageName=='Completed Sale') || (o.StageName=='Hot') ||(o.StageName=='Comp Requested') ) ) { thisacc.Acct_Rep_ID_Mystics__c = userid2usermap.get(o.OwnerId).Archtics_Rep_ID_Mystics__c; accid2accmap.put(o.AccountId, thisacc); MSEaccids.add(o.AccountId); // mystics now created in MSE as well } } } } if (accid2accmap.size() > 0) update accid2accmap.values(); //if (capitalsaccids.size() > 0) //Archtics.createFuture(capitalsaccids, 'Capitals'); //if (wizardsaccids.size() > 0) //Archtics.createFuture(wizardsaccids, 'Wizards'); //changed from wizardsaccids to MSEaccids 130711 JN if (MSEaccids.size() > 0) Archtics.createAccountsInArchtics(MSEaccids, 'MSE'); Archtics.HasSentArchticsCreate = TRUE; } //end if IsAfter }
- Gavin Britto
- August 04, 2016
- Like
- 0
- Continue reading or reply
Format Date in Visual Force page
I need Help converting 2016-01-08T19:00:00 to 01/08/2016
I want to truncate the time (19:00:00 )
This is what I wrote:
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
That didn't work either
I want to truncate the time (19:00:00 )
This is what I wrote:
<apex:column headerValue="Event Date"> <apex:outputText value="{0,date,MM'/'dd'/'yyyy}"> <apex:param value="{!listMysticsmailMap[m].eventDateTime}" /> </apex:outputText> </apex:column>
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
<apex:outputText value="{0,date,MM/dd/yyyy}">
That didn't work either
- Gavin Britto
- April 05, 2016
- Like
- 0
- Continue reading or reply
Field Update Trigger 2
To give you some background, Contact is the parent object and Concept_Email__c is the child object.
I am trying to write a tirgger that would update the
The arctics ID which is named "Concept_email_Arctics_ID_MSE__c" on Concept_Email__c object when it is changed
Below is the code snippet that I've started. Any help with fixing the trigger below will be appreciated.
As of now I am getting a syntactical error "Invalid field contact for sObject contact"
I am trying to write a tirgger that would update the
The arctics ID which is named "Concept_email_Arctics_ID_MSE__c" on Concept_Email__c object when it is changed
Below is the code snippet that I've started. Any help with fixing the trigger below will be appreciated.
As of now I am getting a syntactical error "Invalid field contact for sObject contact"
trigger UpdateArchticIDEmail on Contact (After Update) { for(Contact cont: Trigger.New) { //Select Arctics ID from Contact__c object Contact ArchID=[select Archtics_ID__c from Contact where id=:cont.Contact]; //Select Arctics ID from Concept_Email__c object list<Concept_Email__c> cec=[select Concept_email_Arctics_ID_MSE__c from Concept_Email__c WHERE Contact=:cont.id]; List<Concept_Email__c> listemail=new List<Concept_Email__c>(); for(Concept_Email__c uid:cec) { //Assign Updated Details from Contact__c object to Concept_Email__c Object uid.Concept_email_Arctics_ID_MSE__c=ArchID.Archtics_ID__c; listemail.add(uid); } update listemail; } }
- Gavin Britto
- September 10, 2015
- Like
- 0
- Continue reading or reply
field update trigger
To give you some background, I have a parent object called Concept_Master_Contact__c and child object called Concept_Email__c
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
- Gavin Britto
- September 02, 2015
- Like
- 0
- Continue reading or reply