-
ChatterFeed
-
0Best Answers
-
2Likes Received
-
0Likes Given
-
5Questions
-
8Replies
Visualforce page in Publisher/Quick Action
-
- CW83
- April 29, 2015
- Like
- 0
- Continue reading or reply
Test Code Help!
global class mLSendEmail implements Process.Plugin {
global Process.PluginResult invoke(Process.PluginRequest request) {
// Get the subject of the Chatter post from the flowgj
//String emailS = (String) request.inputParameters.get('emailListString');
String campaignId = (String) request.inputParameters.get('campaignId');
String tempId = (String) request.inputParameters.get('emailTempId');
//system.debug(idS);
String userIdVar = UserInfo.getUserId();
//List<String> emailList = emailS.split(', ');
User userObject = [SELECT Name, Email
FROM User
WHERE Id = :userIdVar.left(15)
LIMIT 1]; //(String) request.inputParameters.get('userName');
List<CampaignMember> test = [SELECT ContactId, CampaignId
FROM CampaignMember
WHERE CampaignId = :campaignId];
List<Contact> contacts = [SELECT Id, Name, Email
FROM Contact
WHERE Id IN (SELECT ContactId
FROM CampaignMember
WHERE CampaignId = :campaignId AND ContactId != null)
];
List<Lead> leads = [SELECT Id, Name, Email
FROM Lead
WHERE Id IN (SELECT LeadId
FROM CampaignMember
WHERE CampaignId = :campaignId AND LeadId != null)
];
system.debug('EMAIL TEMPLATE ID: ' + tempId);
system.debug('VALUE OF CONTACTS: ' + contacts);
List<Messaging.SingleEmailMessage> mails =
new List<Messaging.SingleEmailMessage>();
if (!contacts.isEmpty()) {
system.debug('mLSendEmail.cls - contacts != null');
for (integer i = 0; i <= contacts.size()-1; i++) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId(tempId);
mail.setReplyTo(userObject.Email);
mail.setSenderDisplayName(userObject.Name);
mail.setTargetObjectId(contacts.get(i).Id);
mails.add(mail);
}
} else if (!leads.isEmpty()) {
system.debug('mLSendEmail.cls - leads != null');
for (integer i = 0; i <= leads.size()-1; i++) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId(tempId);
mail.setReplyTo(userObject.Email);
mail.setSenderDisplayName(userObject.Name);
mail.setTargetObjectId(leads.get(i).Id);
mails.add(mail);
}
} else {
system.debug('mLSendEmail.cls - else');
}
Messaging.sendEmail(mails);
// return to Flow
Map<String,Object> result = new Map<String,Object>();
return new Process.PluginResult(result);
}
global Process.PluginDescribeResult describe() {
Process.PluginDescribeResult result = new Process.PluginDescribeResult();
result.Name = 'Marketing Email Plugin';
result.Tag = 'ML Email';
result.inputParameters = new
List<Process.PluginDescribeResult.InputParameter>{
new Process.PluginDescribeResult.InputParameter('emailTempId',
Process.PluginDescribeResult.ParameterType.STRING, true),
new Process.PluginDescribeResult.InputParameter('campaignId',
Process.PluginDescribeResult.ParameterType.STRING, true)
};
result.outputParameters = new
List<Process.PluginDescribeResult.OutputParameter>{ };
return result;
}
}
-
- CW83
- March 26, 2015
- Like
- 0
- Continue reading or reply
javascript button update field
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);
The code is not throwing errors on the object it is just not updating the field. The page is reloading. Anything wrong with the code?
-
- CW83
- January 06, 2014
- Like
- 2
- Continue reading or reply
When validating a change set in production I get an "Inactive User" error on a ChatterAnswers class
Here is the error I am getting:
Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []", Failure Stack Trace: "Class.ChatterAnswers.createAccount: line 4, column 1 Class.ChatterAnswersCreateAccountTest.validateAccountCreation: line 10, column 1"
I am stumped. I was able to validate and deploy from my dev sandbox to my UAT sandbox but now I get this error in production when I go to validate.
I looked to see if I had any assignment rules that were trying to assign to an inactive user. I also looked to make sure I didn't have any inactive users that are Chatter Answers users.
Any ideas?
-
- CW83
- December 14, 2013
- Like
- 0
- Continue reading or reply
pageBlockTable sort controller
I have built a VF page to extend the use of the Mass Edit and Mass Update App from the Force.com Labs to a custom object. My dilemma is I can't get the table to sort my the "Job Ticket Name" I have built a "sortExtension" controller, but I don't think that is going to work. Below is the code for the VF page and the controller. I also don't know if sorting this is even possible since it is input fields. Any help is greatly appreciated.
VF Page
<apex:page standardController="Job_Ticket__c" extensions="sortExtension" recordSetVar="unused" sidebar="false"> <!-- for this page to work with a specific custom object, change standController="entityname" to custom object api name For example, if custom object name is Warehouse__c, change first part of the first line to standardController="warehouse__c" --> <apex:includeScript value="{!$Resource.UtilJS}" /> <apex:form > <apex:pageBlock > <apex:pageMessages /> <apex:pageBlock > Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first. </apex:pageBlock> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Return" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!selected}" var="a" id="table"> <apex:column headerValue="Job Ticket Name"> <apex:inputField value="{!a.name}"/> </apex:column> <apex:column headerValue="Estimated Start Date"> <apex:inputField value="{!a.Estimated_Start_Date__c}"/> </apex:column> <apex:column headerValue="Estimated Hours to Complete"> <apex:inputField value="{!a.Estimated_Hours_to_Complete__c}"/> </apex:column> <apex:column headerValue="Estimated Completion Date"> <apex:inputField value="{!a.Estimated_Completion_Date__c}"/> </apex:column> <apex:column headerValue="Estimated Resume Date"> <apex:inputField value="{!a.Estimated_Resume_Date__c}"/> </apex:column> <apex:column headerValue="Actual Completion Date"> <apex:inputField value="{!a.Actual_date_of_completion__c}"/> </apex:column> <apex:column headerValue="Actual Hours to Complete"> <apex:inputField value="{!a.Actual_hours_to_complete__c}"/> </apex:column> <apex:column headerValue="Actual Resume Date"> <apex:inputField value="{!a.Actual_Resume_Date__c}"/> </apex:column> <apex:column headerValue="Actual Start Date"> <apex:inputField value="{!a.Actual_Start_Date__c}"/> </apex:column> <apex:column headerValue="Resource Assigned"> <apex:inputField value="{!a.Resource_Assigned__c}"/> </apex:column> <apex:column headerValue="Task Description"> <apex:inputField value="{!a.Task_Description__c}"/> </apex:column> <apex:column headerValue="Ticket Status"> <apex:inputField value="{!a.Ticket_Status__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller
<apex:component > public class sortExtension{ public Job_Ticket__c Job Ticket; public ApexPages.StandardController controller {get; set;} { public List<Job_Ticket__c> Job Ticket; public sortExtension (ApexPages.Standardcontroller c) </Job_Ticket__c> } { this.controller = c; Job Ticket = (Job_Ticket__c)Controller.getRecord(); } public Job_Ticket__c [ ] getUnitList() Name = ([Select Name,Estimated_Start_Date__c,Estimated_Hours_to_Complete__c,Estimated_Completion_Date__c,Estimated_Resume_Date__c,Actual_date_of_completion__c,Actual_hours_to_complete__c,Actual_Resume_Date__c,Actual_Start_Date__c,Resource_Assigned__c,Task_Description__c,Ticket_Status__c from Job_Ticket__c Where Job_Ticket__c.Name__r = :TC.id ORDER BY Name]); return Name;} </apex:component>
-
- CW83
- March 20, 2013
- Like
- 0
- Continue reading or reply
javascript button update field
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);
The code is not throwing errors on the object it is just not updating the field. The page is reloading. Anything wrong with the code?
-
- CW83
- January 06, 2014
- Like
- 2
- Continue reading or reply
Test Code Help!
global class mLSendEmail implements Process.Plugin {
global Process.PluginResult invoke(Process.PluginRequest request) {
// Get the subject of the Chatter post from the flowgj
//String emailS = (String) request.inputParameters.get('emailListString');
String campaignId = (String) request.inputParameters.get('campaignId');
String tempId = (String) request.inputParameters.get('emailTempId');
//system.debug(idS);
String userIdVar = UserInfo.getUserId();
//List<String> emailList = emailS.split(', ');
User userObject = [SELECT Name, Email
FROM User
WHERE Id = :userIdVar.left(15)
LIMIT 1]; //(String) request.inputParameters.get('userName');
List<CampaignMember> test = [SELECT ContactId, CampaignId
FROM CampaignMember
WHERE CampaignId = :campaignId];
List<Contact> contacts = [SELECT Id, Name, Email
FROM Contact
WHERE Id IN (SELECT ContactId
FROM CampaignMember
WHERE CampaignId = :campaignId AND ContactId != null)
];
List<Lead> leads = [SELECT Id, Name, Email
FROM Lead
WHERE Id IN (SELECT LeadId
FROM CampaignMember
WHERE CampaignId = :campaignId AND LeadId != null)
];
system.debug('EMAIL TEMPLATE ID: ' + tempId);
system.debug('VALUE OF CONTACTS: ' + contacts);
List<Messaging.SingleEmailMessage> mails =
new List<Messaging.SingleEmailMessage>();
if (!contacts.isEmpty()) {
system.debug('mLSendEmail.cls - contacts != null');
for (integer i = 0; i <= contacts.size()-1; i++) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId(tempId);
mail.setReplyTo(userObject.Email);
mail.setSenderDisplayName(userObject.Name);
mail.setTargetObjectId(contacts.get(i).Id);
mails.add(mail);
}
} else if (!leads.isEmpty()) {
system.debug('mLSendEmail.cls - leads != null');
for (integer i = 0; i <= leads.size()-1; i++) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId(tempId);
mail.setReplyTo(userObject.Email);
mail.setSenderDisplayName(userObject.Name);
mail.setTargetObjectId(leads.get(i).Id);
mails.add(mail);
}
} else {
system.debug('mLSendEmail.cls - else');
}
Messaging.sendEmail(mails);
// return to Flow
Map<String,Object> result = new Map<String,Object>();
return new Process.PluginResult(result);
}
global Process.PluginDescribeResult describe() {
Process.PluginDescribeResult result = new Process.PluginDescribeResult();
result.Name = 'Marketing Email Plugin';
result.Tag = 'ML Email';
result.inputParameters = new
List<Process.PluginDescribeResult.InputParameter>{
new Process.PluginDescribeResult.InputParameter('emailTempId',
Process.PluginDescribeResult.ParameterType.STRING, true),
new Process.PluginDescribeResult.InputParameter('campaignId',
Process.PluginDescribeResult.ParameterType.STRING, true)
};
result.outputParameters = new
List<Process.PluginDescribeResult.OutputParameter>{ };
return result;
}
}
- CW83
- March 26, 2015
- Like
- 0
- Continue reading or reply
javascript button update field
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);
The code is not throwing errors on the object it is just not updating the field. The page is reloading. Anything wrong with the code?
- CW83
- January 06, 2014
- Like
- 2
- Continue reading or reply
When validating a change set in production I get an "Inactive User" error on a ChatterAnswers class
Here is the error I am getting:
Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []", Failure Stack Trace: "Class.ChatterAnswers.createAccount: line 4, column 1 Class.ChatterAnswersCreateAccountTest.validateAccountCreation: line 10, column 1"
I am stumped. I was able to validate and deploy from my dev sandbox to my UAT sandbox but now I get this error in production when I go to validate.
I looked to see if I had any assignment rules that were trying to assign to an inactive user. I also looked to make sure I didn't have any inactive users that are Chatter Answers users.
Any ideas?
- CW83
- December 14, 2013
- Like
- 0
- Continue reading or reply
Actions Plans V3
I've set up the Action Plans app, (https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003HcINEA0)
And following the documentation.
First up it would seem the documentation for setting up a Custom Object against the action plans is a bit out of date, but I can work around the slight differences there I believe.
However, I'm getting the following error when running tests.
Class.ActionPlansBatchBuilderTest.runBatchException: line 316, column 1.
I thought this was down to some changes I had made being incorrect so I ran all tests on production. They passed.
I then refreshed the Sandbox, and once ready ran the tests there. And this error comes up immediately.
Has anyone else encountered this problem with Action Plans, and found a work around?
- davidgillen
- July 23, 2013
- Like
- 0
- Continue reading or reply