-
ChatterFeed
-
137Best Answers
-
0Likes Received
-
0Likes Given
-
31Questions
-
1345Replies
Need help
I have a task like this..
User receives an Email with a link, When he/she clicks on the link it will redirect to page (Say HelloWorld)..
After entering details on that page and hit save, it should be (Helloworld page) converted as pdf and Saved to Purticular Custom Object (Say Yahoo) as Attachment.
Is there any ways to achieve it?
thanks
-
- Vigneshwaran Loganathan
- March 06, 2015
- Like
- 0
- Continue reading or reply
Can we display a confirmation message of successful record creation on standard detail page?
Please let me know how to meet this requirement.
Thank you in advance.
-
- Yashaswee Nemmani
- December 22, 2014
- Like
- 0
- Continue reading or reply
How to validate uploaded file as image
Can anyone tell me how to validate the uploaded file as image?
My vfp:
<apex:page standardController="Contact" sidebar="false" extensions="DpConnectApiExt"> <apex:form > <apex:outputPanel id="ProfilePicturePanel"> <apex:pageMessages ></apex:pageMessages> <apex:outputText ><b>Current User Profile Picture Using Connect API</b></apex:outputText><br/> <apex:actionRegion > <center> <apex:image url="{!UserfullPhoto}" /> </center><br/><br/> </apex:actionRegion> </apex:outputPanel> <apex:outputtext > <b> Uploading Image Via Connet API </b></apex:outputtext> <apex:inputfile value="{!file}"></apex:inputfile> <apex:commandButton value="Submit" action="{!upload}" /> </apex:form> </apex:page>
and my controller:
global class DpConnectApiExt { global String UserfullPhoto { get; set; } global transient Blob file{get;set;} global DpConnectApiExt(ApexPages.StandardController controller) { ConnectApi.Photo p = ConnectApi.ChatterUsers.getPhoto(null, UserInfo.getUserId()); UserfullPhoto =p.fullEmailPhotoUrl; } public void upload(){ system.debug('File:'+file); //I want to validate here ConnectApi.BinaryInput b=new ConnectApi.BinaryInput(file,'image/jpeg','myimage'); ConnectApi.ChatterUsers.setPhoto(null,userinfo.getUserId(),b); } }
I dont know how to validate the blob data type
any help would be appreciatble
Thanks in advance
Karthick
-
- SS Karthick
- December 15, 2014
- Like
- 0
- Continue reading or reply
How to get values in Controller without submitting form?
I want that if no checkbox is checked then automatically submit button will be disabled and if use checks any them it should be enabled to click.
This has to take effect as soon as user deselect or select any checkbox.
Can this be done without using JavaScript? Through the Controller?
-
- Mak One
- June 24, 2014
- Like
- 0
- Continue reading or reply
Unable to update records using batch Apex
public class INFSimpleBatchExp implements Database.Batchable<sobject> {
public Database.QueryLocator start(database.BatchableContext bc )
{
String query = 'select id, name from Account';
return Database.getQueryLocator(query);
}
public void execute (Database.BatchableContext bc, List<Account> scope )
{
for(Account acc : scope)
{
acc.name = acc.name + 'updated';
}
update scope;
}
public void finish(Database.BatchableContext bc)
{
}
}
----------------------------------------------------------------------------------------------------------------------
I am using following statemets in Developer console
INFSimpleBatchExp inF = new INFSimpleBatchExp();
Database.executeBatch(inF, 200);
Anyone kindly let me know where it went wrong?
wwwwwwThanks,
Prakki
-
- Prakki
- June 23, 2014
- Like
- 0
- Continue reading or reply
What error is caused by inserting empty list?
Let's say for whatever reason, my new list of leads is empty. What are the errors caused by inserting an empty list? Does Sf already know not to insert an empty list?
For example,
List<Lead> newLeads = new List<Lead>();
insert newLeads;
Is it recommended that I use the ".isEmpty()" method to only perform an Insert operation when the list is not empty?
if( !(newLeads.isEmpty())
insert newLeads;
-
- Raj R.
- June 19, 2014
- Like
- 0
- Continue reading or reply
Is it possible to enable API on Trial Account?
I want to enable API but don't find option to enable API in my trial account.
please tell me can i enable api to trial account.
-
- shiv prakash
- June 19, 2014
- Like
- 2
- Continue reading or reply
pick list data type , how it stored to database in salesforce srting or integer?
-
- HarishGoudd Buura
- June 19, 2014
- Like
- 0
- Continue reading or reply
Eclipse no more able to display errors while saving files
I facing this issuw since summer 14 release.
Anyone else facing same kind of issues?
-
- Nilesh Jagtap (NJ)
- June 18, 2014
- Like
- 0
- Continue reading or reply
How to create custom controller class?
I have clicked on developer console then in developer console window File --> New --> Appex Class
Give the new class name but when click on create button get the following error.
Please help me how can i fix this so that i can create my custom controller class.
Thanks in advance.
-
- Shahab Khan
- June 18, 2014
- Like
- 0
- Continue reading or reply
Query on ApexCodeCoverageAggregate.
I have to query on ApexCodeCoverageAggregate. I tried like this, but not able to get the result, is there any one have sample codes on this can you please post it. I need how use these Tooling API Objects. Please post with sample class and procedure how to execute these.
I tried like below.
public class SampleClass
{
public List<ApexCodeCoverageAggregate> getCoverage()
{
List<ApexCodeCoverageAggregate> apexCodeCoverageList = [SELECT NumLinesCovered, NumLinesUncovered, ApexClassorTriggerId FROM ApexCodeCoverageAggregate];
System.debug('@@@:apexCodeCoverageList: '+apexCodeCoverageList);
return apexCodeCoverageList;
}
This code is not working.
Thanks
Venkat
-
- VenkataRaja
- June 17, 2014
- Like
- 0
- Continue reading or reply
how to give the api name in apex button logic for a un-managed package
Am created a un-managed package. Earlier my logic and everything works fine, when i created a this package entire sytem field,class apis are changed with some namespace prefix.
Actually i implemented a button logic to execute my apex class. Earlier it was executed, Now when i click on it was showing an error which is in below image. if i added name space prefix to class name also throwing same error.
class:
global class cls_RewardFeedSent{
webservice static string rewardfeedsend(ID rewrdid){
Reward__c rew =new Reward__c();
rew = [select id,name,Active__c,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:rewrdid];
}
}
Button logic :
sforce.connection.sessionId = "{!$Api.Session_ID}";
var rwrd = '{!QnxSPM__Reward__c.Id}';
var result = sforce.apex.execute("cls_RewardFeedSent", "rewardfeedsend", {rewrdid:rwrd});
alert(result);
Can anybody suggest me the solution for this, Thanks in adavnce.
-
- Swamy P R N
- June 13, 2014
- Like
- 0
- Continue reading or reply
Error: Compile Error: Constructor not defined: [test2].<Constructor>() at line 9 column 16
public class test2_test{
public static testMethod void getDataTest()
{
property__c ptest = new property__c(name='test',type__c='1-bhk',lease_term__c = 1,address__c = 'testAddress',parking__c='depend upon owner');
insert ptest;
// apexpages.standardsetcontroller ssc = new apexpages.standardsetcontroller(ptest);
test2 t2 = new test2();
t2.getData();
}
}
i am getting continuously same error message . please tell me where i am exactly making the mistake.
-
- Rishav
- June 13, 2014
- Like
- 0
- Continue reading or reply
Trigger to delete the registration if checkbox is checked
trigger checkCheckBox on Registration__c(after update) {
//List to contain Registration(s) to be deleted.
Registration__c[] toBeDeleted = new list<Registration__c>();
for (Registration__c Register : Trigger.new) {
if (Register.Registration_cancel__c== True) {
toBeDeleted.add(Register);
}
}
delete toBeDeleted;
}
The above code sample is throwing following exception:
caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old
Trigger.deleteDeletedOrgs: line 10, column 1.
How to resolve this?
-
- ExploreForce
- May 09, 2014
- Like
- 0
- Continue reading or reply
Request SOQL input text Visualforce
It is possible to enter a request SOQL in input text of a Visualforce page and after use this request in Apex class?
How do I do this?
I tried this, but that didn't work:
APEX CLASS:
....
public List<case> caseTT {get; set;}
.....
List<case> caseFermeList = caseTT ;
VISUALFORCE:
.....
Request : <apex:inputText value="{!caseTT}"/><br /><br />
Thank you!!!
-
- marys pinda
- May 09, 2014
- Like
- 0
- Continue reading or reply
Trigger only fires on first record in bulk upload
This is driving me a little crazy! I have written a simple trigger which creates or updates the PriceBookEntry in the Standard Pricebook when the Product is inserted or updated. It works when doing it manually but as soon as I upsert using the Data Loader or Jitterbit, it only fires on the first record.
I can't seem to figure out why and was hoping someone may be able to take a look at the code and identify the issue.
Any help would be very much appreciated :)
Code:
trigger CreatePBE on Product2 (after insert, after update) {
sObject s = [select ID from Pricebook2 where IsStandard = TRUE];
Set<ID> ids = new Set<ID>();
list<PricebookEntry> entries=new list<PricebookEntry>();
for (Product2 p : Trigger.new) {ids.add(p.Id);}
if(trigger.isinsert){
for (Product2 p : Trigger.new) {
entries.add(
new PricebookEntry(
Pricebook2Id=s.ID,
Product2Id=p.Id,
UnitPrice=p.Item_Cost__c,
IsActive=p.IsActive,
UseStandardPrice=FALSE)
);
}
insert entries;
}
List <PriceBookEntry> pbe = [select ID, UnitPrice FROM PricebookEntry WHERE Product2ID IN :ids AND Pricebook2ID = '01s20000000FVFV' AND IsActive = TRUE];
if(trigger.isupdate){
for (Product2 p : Trigger.new) {
PriceBookEntry.UnitPrice=p.Item_Cost__c;
}
Update pbe;
}
}
-
- StaceyW
- May 06, 2014
- Like
- 0
- Continue reading or reply
Dynamically render sections based on types
if I have the following records in A
Name. Type
aaa. Checking
bbb. Checking
ccc. Investment
ddd. Saving
I want to build a page showing 3 sections
Checking
aaa
bbb
Investment
ccc
Saving
ddd
it is possible that the data doesn't contain Saving type of record, then I don't want Saving section showing up. It is possible that new types are added, for example, we have another Type Retirement added.
eee. Retirement
then I want to have another section rendered. Basically I can't hard code the name of the Type because it can change/expand, and I can't put fixed number of sections in page because it could change based on Tyes.
Is there any way to achieve this?
-
- Qin Lu
- May 05, 2014
- Like
- 0
- Continue reading or reply
test class for web serivces method
Hi this is my class am using this in one button
can you please any one tell me how to write test class for the web services method.
global class letter
{
WebService static string letter(string id)
{
try
{
Opportunity opp=[Select o.AccountId, o.Delivery__c, from Opportunity o where o.id=:id];
Quote Qt=new Quote();
Qt.name='test';
Qt.OpportunityId=opp.id;
if(opp.Delivery__c!=null|| opp.Deliverys__c!='')
{
newQt.Delivery__c=opp.Delivery__c;
}
insert Qt;
return 'letter';
}
catch(exception ex)
{
return 'Error';
}
}
}
Thanks for your replay
-
- venkateshyadav1243
- June 25, 2013
- Like
- 0
- Continue reading or reply
Issue with doesn't exist file into zip static resource
Hi all.
I have logos.zip into static resource, which contains images with names: 'first.jpg' and 'second.jpg'.
'first' and 'second' are variables, which I retrieve from some field in custom object.
<apex:variable var="propertySlide" value="{!property.PropertyCode__c}.png" /> <apex:image url="{!URLFOR($Resource.logos, propertySlide)}" />
I need to be sure that if this field was empty or, for example, it equals 'third', I shouldn't see doesn't found image icon.
What should I need to do?
-
- snejana
- June 11, 2013
- Like
- 0
- Continue reading or reply
strange issues on test classes
1. created a test class and inserted an opportunity with stage value as 'started';
2. once the insertion was done changed the stage value to 'in progress' and used update statement to update the same.
3. its entering in to the before trigger event but not firing the class method based on th below condition.
test class:
opprtunity opp = new opportunity(stagename = 'started', name = 'test name');
insert opp;
opp.stagename='in progress';
update opp;
if(trigger.new[0].stagename == 'in progress' && trigger.old[0].stagename == 'started')// this is covering.
hadnler.getoppor(trigger.new[0]);///This is not executing in my scenario
plez help me out in this
-
- kiranmutturu
- August 08, 2012
- Like
- 0
- Continue reading or reply
service cloud sub tab name issue
i am getting the new case creation page from custom button in VF page in service cloud console. But after saving the case the case number is not populating there it is still giving New case text on the tab .. how to resolve this?
-
- kiranmutturu
- July 19, 2012
- Like
- 0
- Continue reading or reply
Flow from Account detail page
i have a flow on account detail page.. it will be intiated via button click from the detailed page....in that flow i have some picklist values defaulted to values called "Yes". I selected "No" from the drop down and updating the record in the flow and completed the process. Later I opened the flow from the detail page still it is showing the default value but not the value from the current record.. help me out in this?
-
- kiranmutturu
- July 10, 2012
- Like
- 0
- Continue reading or reply
iOS rendering problem
i am unable to get the vf page as a xls file in iOS(iPAD). I am getting the same in desktops. Even i tried to open a static file which was placed as a static resource , but this is also failed to open... as per these scenarios iOS is not supporting file mangers i think so .. any ideas on this how can i view the excel sheet from salesforce in iPAD?
-
- kiranmutturu
- May 02, 2012
- Like
- 0
- Continue reading or reply
SSO related
how can i use SSO?
we are planning to create a java based application. we are considering 2 approaches. So please guide me which is possible and best.
1. Logging in to that external application through salesforce
2. Logging in to salesforce from that application.
Info: both the application users are same. External application is going to be built on JAVA with external database(data will not be there in force.com database). Simply it needs the same salesforce user login to enter in to that ext app but i need to send some user info(i.e. if i used scenario1 from above). Based on that they will populate the data in that external application
2. may be i can use SSO in the second scenario.
Please guide me the best and possible way to implement..
-
- kiranmutturu
- February 28, 2012
- Like
- 0
- Continue reading or reply
style sheet problem
-
- kiranmutturu
- December 27, 2011
- Like
- 0
- Continue reading or reply
reg aggregate result limitation
i need to get the aggreagted result of opportunity records where there is not conitional pick up... it may go lakhs in future...but my applicaiton is running on force.com platform......any one can help me how to pick up the records in bulk mode......
-
- kiranmutturu
- December 15, 2011
- Like
- 0
- Continue reading or reply
aggregate result to json conversion
i need to send the json string to charts ...i am getting the data as an aggregate result.. help me out in this. i didn't try with wrapper class conversion.. if there is direct way please let me know with out wrapper class.. thank you
-
- kiranmutturu
- December 06, 2011
- Like
- 0
- Continue reading or reply
upserting opportunites
i am getting an error Foreign key external ID: 114.000000 not found for field Source_Account_ID__c in entity Account
when i am upserting the opportunites.. but Source_Account_ID__c is a text fiels in account and it is a primary key in account ...but in account it stored as 114 only..
-
- kiranmutturu
- November 24, 2011
- Like
- 0
- Continue reading or reply
dataloader CLI with oracle connection
i need to connect to oracle database and fetch the records from there and need to insert in to salesforce...
1. we are using oracle 10g --> how to get the drivers for this
2. where I need to place these drivers in the process.
3. how to refer the jdbc driver in the process .?
-
- kiranmutturu
- November 22, 2011
- Like
- 0
- Continue reading or reply
dataloader CLI with oracle connection
could any body give me the procedure to connect to oracle database and fetch the records from there and uplaod in to salesforce.... thank you
-
- kiranmutturu
- November 16, 2011
- Like
- 0
- Continue reading or reply
user access
shall i give access to some of the users in the organization only....and how to remove the chatter component from home page...
-
- kiranmutturu
- November 15, 2011
- Like
- 0
- Continue reading or reply
uploading data in to salesforce through dataloader
i need to upload accounts and contacts in to salesforce but once we upload the accounts how can we map accounts to contacts...
-
- kiranmutturu
- November 14, 2011
- Like
- 0
- Continue reading or reply
unable to connect to dataloader 23.0
i am unable to login in to dataloader 23.0 but able to connect previous versions .. i am getting the below error
failed to send request to https://login.salesforce.com/services/soap/u/23.0...
-
- kiranmutturu
- November 14, 2011
- Like
- 0
- Continue reading or reply
more than 50000 records in a single shot
i need to built a button on avf page where it needs to give more than 50000 records in an excell...
-
- kiranmutturu
- November 10, 2011
- Like
- 0
- Continue reading or reply
dataloader
is it possible to connect to different datasource objects in a single go? like i need to install the accounts contacts and opportunities in a single shot. from external datasource or 3 individula csv files....what is the best way to implement this?
-
- kiranmutturu
- November 10, 2011
- Like
- 0
- Continue reading or reply
vfpage with google charts
i am developing a vfpage which contains some heavy data like datatables and google charts.... is the same solution can be viewed in all the mobile devices that are supported by the salesforce.? what are all the limitations in this..
vfpage solution is working fine in the salesforce native platform but this can be the same in mobile or not if this page is mobile ready page...
-
- kiranmutturu
- November 04, 2011
- Like
- 0
- Continue reading or reply
custom button to retrieve more than million record S
i need a button which generates an excel file with more than 1 million records...will there be any limit in the excell storage also?
-
- kiranmutturu
- October 27, 2011
- Like
- 0
- Continue reading or reply
default dashbaord rendering
when ever we click on dashbaord tab automatically the last used dashboard is rendered but i need to change the behavious like when ever i clicked on the tab i have an another dashboard page called homepage. and i want to land evry time when i click the dashboard standard tab. will this be possible?
Thank you
-
- kiranmutturu
- October 19, 2011
- Like
- 0
- Continue reading or reply
Reg commandlink working nature
i developed a vf component for a dasboard . in that i am having a link .. when i clicked the link the url seems to be like this
https://cs6.salesforce.com/01ZN00000008ekOMAQ?inline=1 .. that inline=1 is the extra parameter causes me the problem. I am directing to another dashboard page while clicking on the link...if i remove the inline=1 i am able to get my desire result.. so please help me out in this
-
- kiranmutturu
- October 14, 2011
- Like
- 0
- Continue reading or reply
How to enable Lightning look and feel for the Community Users in the Sites in Salesforce
- Amrut
- May 01, 2018
- Like
- 0
- Continue reading or reply
Date format changes when used on Visualforce Page Search
I am attempting to create a VF page with 4 fields for user inputting. 2 of these fields are Date fields which when filled in like MM/DD/YYY when I press the search button to call my custom controller the date in the field populated has its format changed to Tue Dec 26 00:00:00 GMT 2017 and doesnt seem to be being applied in the search itself as all records are returned and not ones just for the date entered.
Can someone help me with gettign the format to stay as I think this is the cause of the date field not being used in the search criteria.
Please see my VF Page and controller code below.
Thank you very much for any help you can provide,
Shawn
VF Page Code -
<apex:page controller="SubSearchController"> <apex:form> <apex:pageBlock id="pb"> <apex:pageBlockButtons> <apex:commandButton action="{!searchRecords}" value="Search" rerender="pb"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:outputLabel value="Account Id" /> <apex:inputText value="{!AccId}"/> <apex:outputLabel value="Status" /> <apex:inputText value="{!SubStatus}"/> <apex:outputLabel value="Service Activation date" /> <apex:inputText value="{!SAD}"/> <apex:outputLabel value="Term End Date" /> <apex:inputText value="{!TermEnd}"/> </apex:pageBlockSection> <apex:pageBlockTable var="record" value="{!records}" id="pbTable"> <apex:column value="{!record.Name}" /> <apex:column value="{!record.Zuora__Status__c}" /> <apex:column value="{!record.Zuora__ServiceActivationDate__c}" /> <apex:column value="{!record.Zuora__TermEndDate__c}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller Code -
public class SubSearchController { public String AccId {get;set;} public String SubStatus {get;set;} public Date SAD {get;set;} public Date sadDate = Date.valueOf(SAD); public Date TermEnd {get;set;} public Date TermDate = Date.valueOf(TermEnd); public List<Zuora__Subscription__c> records {get; private set;} public SubSearchController(){ records = new List<Zuora__Subscription__c>(); } public PageReference searchRecords() { records = [SELECT Zuora__Account__c, Zuora__Status__c, Zuora__ServiceActivationDate__c, Zuora__TermEndDate__c, OpportunityId__c, Total_Booking_Amount__c, Id, Name FROM Zuora__Subscription__c WHERE Zuora__Account__c = : AccId AND Zuora__Status__c = : SubStatus AND (Zuora__ServiceActivationDate__c = : sadDate OR Zuora__TermEndDate__c = :TermDate)]; return null; } }
- Shawn Reichner 29
- January 04, 2018
- Like
- 0
- Continue reading or reply
Custom API name?? Is it possible
I am trying to complete the exercise where API name 'Trail__c' is required.
Create a custom object with 'Trail' as the Label and Object Name. The resulting API name will need to be 'Trail__c'.
It clearly mentions in the error blank spaces or consecutive underscores not allowed. How do I achieve this? Thanks in advance.
- Aparna Murthy
- August 16, 2016
- Like
- 0
- Continue reading or reply
- Soundar
- April 15, 2016
- Like
- 0
- Continue reading or reply
Am facing the following error!
public SelectOrganization(ApexPages.StandardSetController controller) {
}
public List<Account> getAccounts() {
if(Accountlist == null) {
Accountlist = new List<Account>();
for(Account a: [select Id, Name from Account limit 25]) {
// As each Account is processed we create a new Account object and add it to the accountList
Accountlist.add(new Account(a));
}
return Accountlist;
}
}
Error:SObject constructor must use name=value pairs at line 16 column 17
Please help.
What needs to be done.
- Shruthi GM 4
- March 17, 2016
- Like
- 0
- Continue reading or reply
How to find the performed operations by an user on a day in Prod.
Hi Folks,
I did not set debug logs for an User but I want to find the operations performed by the User on a particuar day. Is is possible to query on all objects to find out what an user did on particular day?
- vamshi Cap
- March 17, 2016
- Like
- 0
- Continue reading or reply
Can we create a package along with the custom labels?
I am going to create a package which consists apex classes, vf pages, custom settings, static resources.
now my question is i have created some custom labels and called in visual force pages, can i create package along with custom labels??
Thanks in advance.
- venkyyy
- September 10, 2015
- Like
- 0
- Continue reading or reply
Need help
I have a task like this..
User receives an Email with a link, When he/she clicks on the link it will redirect to page (Say HelloWorld)..
After entering details on that page and hit save, it should be (Helloworld page) converted as pdf and Saved to Purticular Custom Object (Say Yahoo) as Attachment.
Is there any ways to achieve it?
thanks
- Vigneshwaran Loganathan
- March 06, 2015
- Like
- 0
- Continue reading or reply
Help with testing a trigger that calls @future method in a separate APEX class
I have hit a wall and need help on how to test @future methods which are called from a trigger.
I think it has something do with the fact that @future methods are no necessarily processed immediately and as such my assertions are not passing, any help on how to get my code covered would be greatly appreciated,
What the trigger does is reassigns open and waiting cases to a queue when a user is disabled.
The trigger:
trigger user_deactivated_reassign_case on User (before update) {
for(User u : trigger.new){
User oldUsr = Trigger.oldMap.get(u.Id);
if(oldUsr.IsActive==TRUE && u.IsActive==FALSE){
User newUsr = Trigger.newMap.get(u.Id);
string recordIds = u.Id;
user_deactivation_reassign_case_class.reassign_case(recordIds);
}
}
}
The @future Apex Class:
public class user_deactivation_reassign_case_class {
@future
public static void reassign_case(string recordIds){
List<Case> cas = [SELECT Id, Type FROM Case WHERE OwnerId=:recordIds];
List<Case> casesTobeUpdated = new List<Case>();
for(Case currentCase : cas){
if(currentCase.Status=='Open'||currentCase.Status=='Waiting Response'||currentCase.Status=='On Hold'){
if(currentCase.Type=='AU.COM'||currentCase.Type=='Customer Service'){
currentCase.OwnerId='00G90000001mq6F'; //Premium Support L2
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Management'){
currentCase.OwnerId='00G90000001mq5m'; //Management
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Administration'||currentCase.Type=='Domain Dispute'){
currentCase.OwnerId='00G90000001mq65'; //Premium Admin
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='EDU.AU'||currentCase.Type=='GOV.AU'||currentCase.Type=='Corporate'){
currentCase.OwnerId='00G90000001mzrl'; //Corporate
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='VPS Unmanaged'||currentCase.Type=='VPS Managed'){
currentCase.OwnerId='00G90000001nJfA'; //VPS Unmanaged
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Sales'||currentCase.Type=='Social Media Sales'||currentCase.Type=='Online Marketing Sales'){
currentCase.OwnerId='00G90000001mzrH'; //Retail Sales
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Online Marketing Support'){
currentCase.OwnerId='00G90000001mzrR'; //Online Marketing Support
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Web Design'){
currentCase.OwnerId='00G90000001mzT4'; //Web Design
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Website Security'){
currentCase.OwnerId='00G90000001nAl0'; //Website Security
casesTobeUpdated.add(currentCase);
}
else if(currentCase.Type=='Credit Control'){
currentCase.OwnerId='00G90000001nAlK'; //Credit Control
casesTobeUpdated.add(currentCase);
}
else{
currentCase.OwnerId='00G90000001mq6F'; //Premium Support L2
casesTobeUpdated.add(currentCase);
}
}
}
update casesTobeUpdated;
}
}
And the test class which I can't figure out:
@isTest
public class user_deactivation_reassign_case_test {
public static testmethod void test_user_termination(){
User thisUser = [SELECT Id FROM USER WHERE Name='System Automation'];
system.runAs(thisUser){
User u = new User(FirstName='Test',
LastName='Test',
Username='apextest@netregistry.com',
Email='apextest@netregistry.com',
Alias='test',
CommunityNickname='test',
TimeZoneSidKey='Australia/Sydney',
LocaleSidKey='en_US',
EmailEncodingKey='UTF-8',
ProfileId='00e90000001NAum',
LanguageLocaleKey='en_US');
insert u;
Account acc = new Account(Account_Ref__c='1',Name='Test', Reseller_Id__c=1, Virtualisation_Id__c=1);
insert acc;
Case cas = new Case (AccountId=acc.Id,OwnerId=u.Id,Type='AU.COM',Status='Open',Brand__c='Netregistry');
insert cas;
update u;
string recordIds = u.Id;
system.assertEquals(cas.OwnerId, '00G90000001mq6F');
}
}
}
I have read other posts saying I need to use Test.startTest(); and Test.stopTest(); but I can't figure out where this fits into a @future class being called via a trigger
- William Keam
- March 06, 2015
- Like
- 0
- Continue reading or reply
System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'urn:sap-com:document:sap:soap:functions:mc-style:...'
I'm trying to consume/call a webservice from SAP/APIGEE. I have already the target endpoint to remotes sites settings, etc.
Given the WSDL file from SAP/APIGEE team, I have generated the stub class using "Generate from WSDL"
But when trying to call the service, i am getting this error:
System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'urn:sap-com:document:sap:soap:functions:mc-style:GetEmployeeResponse'
Here's the WebServiceCallout.invoke lines (if it matters: i can see that the expected response is correctly specified, and yet it looks for something else)
WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'urn:sap-com:document:sap:soap:functions:mc-style', 'GetEmployee', 'urn:sap-com:document:sap:soap:functions:mc-style', 'GetEmployeeResponse', 'HLG_sapComDocumentSapSoapFunctionsMcS.GetEmployeeResponse_element'} );
I tried to simulate the call using SOAPui, and the result/response is something like this:
<ns1:GetEmployeeResponse xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style"> <Empinfo> <EmployeePersonalNumber>10033928</EmployeePersonalNumber> <UserName>abhyrtj</UserName> <AssignmentType>AB</AssignmentType> <AssignmentTypeDescription>test description</AssignmentTypeDescription> <CompanyCode>CC</CompanyCode> <CmapnyName>Test Company</CmapnyName> <Ctps>test</Ctps> <CtpsSerie>test</CtpsSerie> <CtpsUF>test</CtpsUF> <Imss>test</Imss> <Nationality>US</Nationality> <CountryName>USA</CountryName> <AnnualSalary>435345.02</AnnualSalary> <AnnualSalaryCurrency>$</AnnualSalaryCurrency> <AnnualCurrencyDescription>test description</AnnualCurrencyDescription> <WorkContract>AB</WorkContract> <WorkContractDescription>test description</WorkContractDescription> <EndDate>2017-12-25</EndDate> <EmploymentPercentage>98.25</EmploymentPercentage> <HoursPerWeek>9.00</HoursPerWeek> </Empinfo> </ns1:GetEmployeeResponse>
THANK YOU SO MUCH IN ADVANCE!
- Aldrin Rasdas 26
- January 04, 2015
- Like
- 0
- Continue reading or reply
Email trigger for Visualforce-Component
Thanks in advance ! :)
- Bernd Nawrath
- January 03, 2015
- Like
- 0
- Continue reading or reply
Iterate through the records of Standard Account Object
I want to iterate though the records of Account object inside a trigger of another Object. I tried to do it as follows,
trigger CCTriggerToUpdateAccounts on CC__c (before insert, before update) {
List<Account> accountList = [SELECT MyField__c FROM Account];
CC__c[] configs = Trigger.new;
for (Configuration__c c :configs){
for(Account a: accountList){
a.Sync_to_AG__c = c.CCID__c;
}
update accountList;
}
}
It works. But The Account iteration goes for several times. I only have 1 Account in my list.
How can I make it to iterate according to the number of records in the Account object?
Please Help me. Thank you very much in advance.
- Sam Alex
- January 02, 2015
- Like
- 1
- Continue reading or reply
Call out (@Future) when the status is changed on contact
I am making a callout to external webservices ,I am not getting any error ,
Here is my problem ,When i update values on contact that wont value are not passing to external webservices.
Its passing the random records.
Below is my trigger code and apex Class
trigger Rephistorytracking on contact (after update,before update) {
RepTriggerHandlerclass contactHandler = new RepTriggerHandlerclass ();
Jcoreutil JcoreHandler= new Jcoreutil();
if(Trigger.isAfter && Trigger.isUpdate) {
contactHandler.onAfterUpdate(Trigger.New, Trigger.oldMap);
}
if(Trigger.IsAfter && Trigger.isUpdate)
{
contactHandler.onAftercontactUpdate(Trigger.New);
}
if(Trigger.IsUpdate && Trigger.isBefore)
{
Jcoreutil.JcoreAdd();
}
}
###################APEX CLASS####################################
public class Jcoreutil {
@future(callout=true)
public static void JcoreAdd()
{
Set<Id> TerminateCntId= new Set<Id>();
Set<Id> RepIdsValue= new Set<Id>();
List<Id> CntListIds= new List<Id>();
List<contact> TerminateCntList= new List<contact>();
String LicenseNumber;
for( contact TerminateCntQuery :[Select Id,Name,CRD__c,FirstName,LastName,Middle_name__c,Gender__c,Address_Type__c,
MailingStreet,MailingCity,MailingState,MailingPostalCode,Email,MobilePhone,
QAM_DSP__r.Name,QAM_DSP__r.CRD__C,QCC_DSP__r.CRD__C,QAM_DSP__r.FirstName,
QAM_DSP__r.LastName,QCC_DSP__r.FirstName,QCC_DSP__r.LastName,Birthdate,Rep_Status__c,
QCC_DSP__c,Term_Date__c,Start_Date__c,LastModifiedDate,HomePhone,Phone,OtherPhone
from Contact where (Rep_Status__c='Terminated'OR Rep_Status__c='Converted') Limit 1])
{
system.debug('TerminateQuery@@@@'+TerminateCntQuery);
if(TerminateCntQuery.Rep_Status__c=='Converted')
{
TerminateCntList.add(TerminateCntQuery);
TerminateCntId.add(TerminateCntQuery.id);
List<License__c> lstLicensesValues=new List<License__c>();
License__c LicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId Limit 1] ;
lstLicensesValues=[Select Id,License__c from License__c where contact__c IN:TerminateCntId];
integer LicensesValue;
LicensesValue=lstLicensesValues.size();
Please help me
I Tried to pass the list of ids,but its give error while calling method in trigger.
Thanks.
Regards,
Jyo
- Jyosi jyosi
- January 01, 2015
- Like
- 0
- Continue reading or reply
debugging for class
hello community, when I was executing with a debug to check on my class this occured:
that's the code for the class:
public class HelperContactTrigger {
//static method
public static List<Account> sendEmail(List<Account> accounts) {
//query on template object
EmailTemplate et=[Select id from EmailTemplate where name= 'Sales: New Customer Email' limit 1];
system.debug(et); //debug to check the template
//list of emails
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
//loop
for(Account con : accounts){
//check for Account
if(con.PersonEmail == null && con.PersonEmail != null){
//initiallize messaging method
Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();
//set object Id
singleMail.setTargetObjectId(con.Id);
//set template Id
singleMail.setTemplateId(et.Id);
//flag to false to stop inserting activity history
singleMail.setSaveAsActivity(false);
//add mail
emails.add(singleMail);
}
}
//send mail
Messaging.sendEmail(emails);
return accounts;
}
}
What do I do? I checked the code and everything a million times.
I was having difficulties running a test class for this programm (System.QueryException: List has no rows for assignment to SObject)
so I have to check if the query statement really does what it's supposed to, it has to work as a mailtrigger when a new account is added but the query is having issues so I have to know what the real problem is.
This is the test class:
@isTest
private class HelperContactTriggerTestneuer {
public static testMethod void myTestMethod() {
Account acc = new Account(Name = 'Test Test');
insert acc;
List<Account> sendMail = [select id from account where (Name='Test Test') and id=:acc.id];
EmailTemplate testTemplate=new EmailTemplate(Name='Neuer Kunde',DeveloperName='Neuer_Kunde',FolderId=Userinfo.getUserId());
insert testTemplate;
HelperContactTrigger.sendEmail(sendMail);
System.assert(acc !=null);
}
}
thanks in advance :)
- Bernd Nawrath
- January 01, 2015
- Like
- 0
- Continue reading or reply
Issue in getContentAsPDF() Function
In my visualforce page i am using getContentAsPDF() for generating feeditem.
After saving the data i am generating feeditem. At this point Feeditem is not having recently saved data.
i suspect getContentAsPDF() not getting the recent data.
Can anybody help me on this?
- kannapapi
- December 24, 2014
- Like
- 0
- Continue reading or reply
Trigger has bugs...... Is there a shorter way to do what I am trying to accomplish in APEX?
First thing that should happen is when a new buyer record is saved or updated (identified by the Active_Buyers__c) field is search through system for records that have (Active_Seller__c) field checked.
Then it should query the account records and pull the ID, name, List Price, Price Range, Owner Email, and Last Modified Email. from the account object where the List Price <= to the Price range and store the results temporarily.
After matches are returned there should be an email notification sent to the LastModifiedByID.email of the record that has the Active Seller field checked. with the
Subject being New Buyer Found,
Body should contain the account name (hyperlink) owner name and owner email of the account with the Active buyers field checked
trigger BuyerSellerMatchTrigger on Account (after insert,after update){
// Capture all records that have Active_Buyers__c field equals true
List <Account> BuyerList = new List<Account>();
Set<String> nameSet= new Set<String>();
Set<String> emailSet;
Boolean Active_Buyers = true;
for(Account a:trigger.new){
if(Active_Buyers__c) {
buyerList.add(a.);
nameSet.add(a.name);
}
}
//check to determine size and the query fields of accounts for the buyer list
if(buyerList.size()>0 && nameSet.size()>0){
List<Account>listOfAccounts=[ select id, name, owner.email, Maximun_Price_Range__c, Price_range__c
from Account where (name in: nameSet) and Active_Seller__c = True and Listed_Price__c <= Price_Range__c];
//Map the result set of active buyers to active sellers
Map<Id, Set<String>>mapOfAccounts=new Map<Id, Set<String>>();
for(Account a:listOfAccounts){
for(account trgrAccountbuyerList){
if(trgrAccount.Active_Seller__c = True){
if(mapOfAccounts.containsKey(trgrAccount.id)
&&!mapOfAccounts.get(trgrAccount.id).contains(a.owner.email))
}
}
emailSet=mapOfAccounts.remove(trgrAccount.id);
emailSet.add(a.owner.email);
mapOfaccounts.put(trgrAccount.id,emailSet);
}
else {
emailSet=new Set<String>();
emailSet.add(a.owner.email);
mapOfaccounts.put(trgrAccount.LastModifiedByid,emailSet);
}
}
}
}
// Email notification trigger
for(Id idey:mapOfaccounts.keySet()){
String emailMessage='Buyer Email account-https://na7.salesforce.com/'+ idey;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses=new List<String>();
toAddresses.addAll(mapOfaccounts.get(idey));
mail.setToAddresses(toAddresses);
mail.setReplyTo('noreply@salesforce.com');
mail.setSenderDisplayName('Buyer Email');
mail.setSubject('Subject');
mail.setPlainTextBody(emailMessage);
mail.setHtmlBody(emailMessage);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
}
}
}
}
- Gar Spencer
- December 23, 2014
- Like
- 0
- Continue reading or reply
Vf page+ enable button based on user
i have a vf page which contains a button, with a record.
i want to enable button based on record owner.contion here i want to enable it only if record owner is other than created user of record.
EX: lets say User A is create record.if user is opened that opened the page contains this record.this time button needs to disabled.
If user B opened this page contains user A created record.this time it needs to be enabled.
can some one help tel me the condtion please.
Regards
Lakshman
- lakshman.matti
- December 23, 2014
- Like
- 0
- Continue reading or reply
Trigger working on Sandbox but not working on production
trigger EmailMessageAfterUpdate on EmailMessage (after insert) {
// limit 1001 used, else it was giving error "System.LimitException: Too many query rows: 50001".
List<case> caseList = [Select id, Status from Case where Status = 'Closed' limit 1001];
for (EmailMessage newEmail : Trigger.new)
{ for(case cc : caseList){
if(cc.Status == 'Closed' && cc.id == newEmail.ParentId){
Case newCase = new Case();
newCase.Subject = newEmail.Subject;
newCase.Parent_Case__c=newEmail.ParentId;
newCase.Category__c = newEmail.Parent.Category__c;
newCase.BusinessHours = newEmail.Parent.BusinessHours;
newCase.Status = 'Re-Opened';
newCase.Sub_Status__c = newEmail.Parent.Sub_Status__c;
insert newCase;
}
}
}
}
- Davinder Kaur 8
- December 23, 2014
- Like
- 0
- Continue reading or reply
Can someone look at my code and tell me where I went wrong?
If a match is found it would then send an email notification to the lastmodifiedBy user of the active seller equals true record to notify them of a potential buyer.
I am getting errors with this code and it will not compile.....
Can someone look at my code and tell me where I went wrong?
trigger BuyerSellerMatchTrigger on Account (after insert, after update) {
List<Account> buyerList=new List<Account>();
Set<String> nameSet=new Set<String>();
Set<String> citySet=new Set<String>();
Set<String> emailSet;
for(Account a:trigger.new){
if(a.Active_buyers__c='True'){
buyerList.add(a);
nameSet.add(a.name);
}
}
if(buyerList.size()>0 && nameSet.size()>0){
List<Account> listOfAccounts=[select id,name,BillingCity,owner.email,Price_range__c from account where (name in :nameSet) and Active_seller__c='True'];
Map<Id,Set<String>> mapOfAccounts=new Map<Id,Set<String>>();
for(Account a:listOfAccounts){
for(account trgrAccount:buyerList){
if(trgrAccount.Active_Seller__c='True' && trgraccount.list_price__c=a.Price_range__c){
if(mapOfAccounts.containsKey(trgrAccount.id) && !mapOfAccounts.get(trgrAccount.id).contains(a.owner.email)){
emailSet=mapOfAccounts.remove(trgrAccount.id);
emailSet.add(a.owner.email);
mapOfaccounts.put(trgrAccount.id,emailSet);
}else {
emailSet=new Set<String>();
emailSet.add(a.owner.email);
mapOfaccounts.put(trgrAccount.LastModifiedByid,emailSet);
}
}
}
}
for(Id idey:mapOfaccounts.keySet()){
String emailMessage='Buyer Email account-https://na7.salesforce.com/'+ idey;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses=new List<String>();
toAddresses.addAll(mapOfaccounts.get(idey));
mail.setToAddresses(toAddresses);
mail.setReplyTo('noreply@salesforce.com');
mail.setSenderDisplayName('Buyer Email');
mail.setSubject('Subject');
mail.setPlainTextBody(emailMessage);
mail.setHtmlBody(emailMessage);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
}
}
}
- Gar Spencer
- December 23, 2014
- Like
- 0
- Continue reading or reply