• ManojSankaran
  • SMARTIE
  • 778 Points
  • Member since 2015
  • SFDC Application Engineer

  • Chatter
    Feed
  • 22
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 113
    Replies


I have a text area field. Field will insert as

apple | Bat | Cat

I need as 

apple

bat

cat

and same like i need to add email body.

 

Hello all! 
I have a standard object "Account" with a custom field(picklist) "Stato";
I want to create a custom field "Nome account" where the value is an automatic incremental number that is assigned when the picklist value of "Stato" is changed to 'Cliente',  if that number was not already present.
For example "AC 000000" where "000000" must be an autonumber.

Can you help me?

Thank you very much!
Hello,

Is it necessary that the owner of an account which is enabled as customer account should have a Role ?
 
  • August 24, 2016
  • Like
  • 0
Hi All,
I have a senariou like this, i have  a picklist and a Checkbox  (both custom field). when we select checkbox true then i need to do picklist mandatory?
Please help me.

Thanks,
Rji
Hi All,
My senariou like this .. I have check box and custom date  field when we select checkbox then the record going to save as current date. it was done by workflow field update . But the probleam is Date field is editable.

i want to locked the date field(Custom date) so that no one can change the date.I have make the checkbox read only through Edit Layout  but still it's editable.
 
is there any other way to make the date field read only?

Thanks,
Raji

I am in confusion to identify the role of triggers in MVC pattern, some one is saying that triggers operates with database and it comes under model part and some one saying that triggers controlls the data to be inserted or updated to the database and comes to controller part of MVC. Please tell me the role of triggers in MVC pattern.

Thanks.
Hi,
I'm in a terrible dilemma with the trigger. I was wondering why there is no id assigned on the record anymore
trigger trigger_Account on Account(before insert, before update){
  for( Account acc : Trigger.new){
    system.debug('Account id: ' + acc.id);
  }
}
this change affected some of my previous triggers
  • June 10, 2016
  • Like
  • 1
Hello,

I have 9 record types in Contact object, but when i check the profile for system admin, in object setttings it only shows 3 record types.
What can be reason
  • May 30, 2016
  • Like
  • 0
I have a one master record and Mr A is the owner of this master  and this record has 6000 child record. Child inherit master ownership
Now Mr B joined in my company . Our idea is move around 2000 child record from Mr A to Mr B. I will create New Master record to Mr B.
If I change the field type of Master child to lookup , can i move this 2000 record from A to B. After moving again if i change field type to Matser child , will my system works without any problem pls advise
thanks
ss
Hi All,

I am new to salesforce development. Need all your help here.

I have a  scenario to write a trigger where while creating List of records in Account object it should check if there are any duplicates with reference to account name.
If exist then it should skip those records and insert the remaing records. 
so my requirement is no need to displayt any error. just have to skip the unfavourable records from trigger.new and save the favourable records in trigger.new alone. 

Please assist me here


 
Pulling in all the contacts from salesforce. But, how to get only the modiifed objects either using etags / if modified since as I dont want to import millions of contacts again if not modified ?
We have been using Survey Force free app which was provided by Salesforce labs. We would like to understand if this app is lightning ready?
I'm working on a trigger that will run before update or before insert.  As the title suggests, I want the trigger to add the account name to the opportunity name but only if the opportunity name is not already present.  The before insert part is easy since lazy sales reps are already used to this being done for them.  But if/when they update an opportunity name, I don't want the account name added a second time.  Here is what I've got so far:
 
trigger OppNameTrigger on Opportunity (before insert, before update) {
    Set<Id> AccountIds = new Set<Id>(); //Initialize a list of Ids
	String sName; //Initialize a string variable to manipulate our Opp names
    String accName;//Initialize a string variable to hold account name value when opp is updated instead of inserted
    
    //Add an account ID to the list for every opportunity caught by trigger
    for (Opportunity op : Trigger.new) {
  
 	  accountIds.add(op.AccountId);
	}
    
//Create a map of Ids and account, querying the name from account records
//whose Id is in the AccountIds list generated earlier
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Name FROM Account WHERE Id IN :accountIds]);
    System.debug(accountMap);

//Loop through all opps setting the new name in a variable and then assigning that
//variables contents to the name field for each opportunity
for (Opportunity op : Trigger.new) {
    //Assigns account name of current op to a variable
    
    accName = accountMap.get(op.AccountId).Name;
    if(trigger.isInsert){
  		// add the account name and amount to current opp name
  		sName = accountMap.get(op.AccountId).Name + ' - ' + op.Name;

  		// set the name :-)
  		op.Name = sName;
    }else {
        if(trigger.oldmap.get(op.Name) != trigger.newmap.get(op.name)){
            if(!op.name.contains(accountMap.get(op.AccountId).Name))
                
                sName = accName + ' - ' + op.Name;
            	op.Name = sName;
        }
    }
    }
}
When I try to edit the opportunity, I get the following error, "Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger OppNameTrigger caused an unexpected exception, contact your administrator: OppNameTrigger: execution of BeforeUpdate caused by: System.StringException: Invalid id: Testing Testing Opps: External entry point".  Anybody have any thoughts on what i'm doing wrong?
 
HI all, I am trying to do a trailhead challenge - create a case queu - in my developer profile. 

Instructions are to go to "Setup", search for "Queues" in Quick Find. The only option I am getting is "Manage Users" --> "Queues" which provides me with a screen called "Queues, Edit View"

This screen looks very different to the trailhead screen shots provided - see attached screen shots.User-added image

This is compared to the trailhead instructions which suggest i should be on a screen looking like this:

User-added image 

Can anyone advice what I am doing wrong and how I could go about finding the trailhead screen?

Many thanks!
Hi,

I need to join four objects for my Visualforce page.
 
I am trying to get customer info, ordered products, and invoiced amount. For example Customer “John” ordered product “ABC” and invoiced amount is “$1200”. In order to get this done, I need to join four objects. Two objects are custom objects and two standard objects.       
 
Objects are: Account, Invoice__c, Invoice_Line__c, Product2
 
Account à Invoice__c à Invoice_Line__c
                   Product2    à Invoice_Line__c
 
Invoice__c object has Account__c lookup column to Account.Id column for relationship
 
Invoice_Line__c object has Invoice__c lookup column to Invoice__c.Id column for relationship
 
Invoice_Line__c object has Product__c lookup column to Product2.Id column for relationship
 
 
I need to merge these four objects to get the following information:
 
Account.Customer_Id__c, Account.Name from Account object
 
Invoice__c.Invoice_Id__c, Invoice__c.Invoice_Date__c from Invoice__c object
 
Invoice_Line__c.Brand__c, Invoice_Line__c.Name, Invoice_Line__c.Net_Amount_US__c from Invoic_Line__c object
 
Product2.ID__c, Product2.Brand__c, Product2.Description__c, Product2.Family, Product2.Product_Line__c, Product2.Product_Series__c from Product2 object
 
I am new to SOQL and Visualforce. What is the best way to get it done? Your help will be appreciated.
 
How do I hide the views when new queues are created?

I am creating a queue and when I go and see that queue is in the view dropdown and when I edit that it has been shared with "All internal Users" How do I avoid that?
I don't want all internal users to see that a new queue is created
I would to create a trigger. I am very new and am having trouble. 

Could somebody please tell me if this is correct?
 
trigger TaskUpdateTrigger on Task (before insert) {
    For (Task t: Trigger.new){
        if(t.what.type == 'Opportunity'){
            System.debug(t.Subject+ 'is related to Opportunity');
        }
    } 
    
}

 
Hi Experts,
I want to send email alerts to opportunity owners when their opportunity close date passed. Let say if an opportunity owner have 4 opportunities with same close date so only one email alert should trigger with all 4 opportunity details like Opportunity name, close date and salesforce link.
I know it can be achieve by batch apex but my batch is not working. I haven't get any error. schedule job done is showing in Sechdule job view.
but Opportuntiy owner didn't get any email.
Please find below my batch:
global class SendEmailToopsowner implements Database.Batchable<sObject>  {
    map<string,list<opportunity>> userEmailTasklistmap = new map<string,list<opportunity>>();
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator([SELECT Id, Name, StageName, CloseDate, Owner.Email FROM Opportunity WHERE CloseDate < TODAY  and StageName != 'closed-Won' or StageName != 'closed-Lost'  ]);
    }
    
    global void execute(Database.BatchableContext BC, List<opportunity> scope){
        for(opportunity opp : scope){
            if(!userEmailTasklistmap.Containskey(opp.owner.email)){
                userEmailTasklistmap.put(opp.owner.email, new list<opportunity>());
            }
            userEmailTasklistmap.get(opp.owner.email).add(opp);
            
          }  
        List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    
            for(string email : userEmailTasklistmap.keyset()){
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                list<string> toAddresses = new list<string>();
                toAddresses.add(email);
                mail.setToAddresses(toAddresses);
                mail.setSubject('Opportunity close date passed');                
                String username = userEmailTasklistmap.get(email)[0].owner.name;
                String htmlBody = '';
                
                htmlBody = '<table width="100%" border="0" cellspacing="0" cellpadding="8" align="center" bgcolor="#F7F7F7">'+
                            +'<tr>'+
                              +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri;line-height: 18px; color: #333;"><br />'+
                                   +'<br />'+
                                    +'Dear '+username+',</td>'+
                            +'</tr>'+
                            +'<tr>'+
                                +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri; line-height: 18px; color: #333;"> You have Pending Task </td>'+
                            +'</tr>'+
                        +'</table>';
 
                htmlBody +=  '<table border="1" style="border-collapse: collapse"><tr><th>Name</th><th>StageName</th><th>CloseDate</th></tr>';
                for(opportunity opp : userEmailTasklistmap.get(email)){
                    
                    String CloseDate = '';
                    if (opp.CloseDate != null)
                        CloseDate = opp.CloseDate.format();                    
                    else
                        CloseDate = '';
                    String Name = opp.Name;
                    datetime dt = opp.CloseDate;
                    string ClosedDate = dt.format('M/d/yyyy');
                    string StageName = opp.StageName;
                    string View = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ opp.id;
                    string clickhere = view;                    
                    htmlBody += '<tr><td>' + Clickhere +'</td><td>' + Name + '</td><td>' + CloseDate + '</td><td>' + CloseDate + '</td></tr>';                    
                }
                 htmlBody += '</table><br>';
                 mail.sethtmlBody(htmlBody);
                 mails.add(mail);                    
            }
             if(mails.size()>0)
             Messaging.sendEmail(mails);
    }
    global void finish(Database.BatchableContext BC){        
    }
}

Kindly help!
My Trigger Code Here: 


trigger ContactCountTrigger on Contact (After insert, After Delete, After Undelete,after update) {

Set<id> setAccountId=new Set<id>();
if(Trigger.isInsert || Trigger.isUndelete || Trigger.isUpdate){
for(Contact con:Trigger.New){
setAccountId.add(con.AccountId);

}
}
if(Trigger.IsDelete){
for(Contact con:Trigger.old){
setAccountId.add(con.AccountId);

}
}
List<Account> listAcc=[select id,noOfContact__c,(Select id from Contacts)from Account where id in:setAccountId];
for(Account acc:listAcc){
acc.noOfContact__c=acc.contacts.size();

}
update listAcc;
}

 

Hi guys,

I have got a button which works perfectly find when generating a contract from Opporutnity.

However, if my opportunity MRR or opportunity Contract month (terms) equats to 0, it does not work. Any idea if there is a workaround?

 

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 

var status = "{!Opportunity.StageName}";

var newRecords = [];

var caseRecordType = sforce.connection.query("Select Id from RecordType where SobjectType = 'Contract' and DeveloperName = 'contract'");

var records = caseRecordType.getArray("records"); 

if (status == "Closed Won") 
{ 
    var c = new sforce.SObject("Contract");
    c.RecordTypeId = records[0].Id;
    c.AccountId = "{!Opportunity.AccountId}";
    c.CompanySignedId = "{!Opportunity.Account_ManagerId__c}";
    c.Opportunity__c = "{!Opportunity.Id}";
    c.Contract_Type__c = "{!Opportunity.Contract_Type__c}";
    c.ContractTerm = "{!Opportunity.Contract_Term_months__c}";
    c.Product__c = "{!Opportunity.Product__c}";
    c.MRR__c = "{!VALUE(TEXT(Opportunity.New_MRR__c))}";
    c.CustomerSignedId = "{!Opportunity.Sold_To_ContactId__c}"; 

    newRecords.push(c); 
    sforce.connection.create(newRecords, 
                             { 
                                 onSuccess : function(result){ 
                                     console.log(result[0]); 
                                     console.log('Success '+result.id); 
                                     alert ('Service contract generated. Please refresh page to view latest case in Related Contract list.'); 
                                     
                                 }, 
                                     
                                     onFailure : function(){ 
                                         console.log('Error '+result[0]); 
                                     } 
                                 
                             }); 
    
} 
else 
{ 
    alert ('Opportunity must be closed won before a service contract can be generated.'); 
}

Thanks!

Regards,
Samantha
 

Hi Team,

I am trying to integrate Stripe(Payment Gateway) with Salesforce. In which i have a requirement to send amount to stripe so that stripe will verify my bank account. I am facing few issues with the request that i am sending from salesforce.
Below is the JSON Format that Stripe is expecting.
{
 "amounts": ["32","45"]
}

I am sending similar format as above from salesforce but when i check in Stripe Console the request looks like this
{
 "amounts": "["32","45"]"
}

If any one faced such issues kindly help me with that.
I have a requirement to assign campaign members to salesforce agents(internal salesforce users) Can any one help me with a solution for this ?


Thanks
Manoj S
Hi Team,

I am trying to create a VF Page same as attached screenshot. Can you please suggestion a way to start with. Which framework to use.



Thanks
Manoj S
User-added image


I have a text area field. Field will insert as

apple | Bat | Cat

I need as 

apple

bat

cat

and same like i need to add email body.

 

Hi
In Contract object, i have the " Payments" as the related object.
In Payments i have the field " Opp renew check" where the values can be 01,02,03 etc. Multiples Payments records can have the value as 01 or 02 or 03 etc.
Now i want that, where its all say, 01, those all record's amount will sum up and show in the Contract object, when new records comes with 02, the latest( highest number) will get sum up.
E.g if two records with 01, and values as 1. $1000
                                                                  2. $500
Those two will sum up as $1500.

When new records come up with 02, say 1. $2000, 2. $ 400
It will change to $2400.

Both are relatd as Master-detail. I tried in trigger as below. But as new to apex, i think some issue with my below trigger, Can anyone plz suggest where i went wrong.
 
trigger paymentTrigger on Payments__c(After insert,after delete){
  List<Contract> conListToUpdate=new List<Contract>();
  Set<Id> conIdSet= new Set<Id>();
  if(Trigger.isAfter){
     if(Trigger.isInsert){
         for(Payments__c pay : trigger.new){
            if(pay.Opp_Renewal_Check__c!= null){
                conIdSet.add(pay.Paid_to_date_2__c);
            }
        }
     }
     if(Trigger.isDelete){
        for(Payments__c pay  : trigger.old){
            if(pay.Opp_Renewal_Check__c!= null){
                conIdSet.add(pay.Paid_to_date_2__c);
            }
        }
     }
  }
 
  if(!conIdSet.isEmpty()){
    List<AggregateResult> aggRes=[SELECT SUM(Id)adding ,Opp_Renewal_Check__c chk FROM Payments__c WHERE Opp_Renewal_Check__c IN : conIdSet AND MAX(Integer.valueOf(Opp_Renewal_Check__c)) Group By Opp_Renewal_Check__c];
    for(AggregateResult agg : aggRes){
      Contract con =new Contract(id=(Id)agg.get('chk'),Paid_to_date_2__c = (Decimal)agg.get('adding'));
        conListToUpdate.add(con);
    }
    if(!conListToUpdate.isEmpty()){
       try{
           update conListToUpdate;
       }catch(DmlException de ){
           System.debug(de.getMessage());
       }
    }
  }
}

Replace Task_Count__c with your Opportunity API field API

 
Let suppose I created one dashboard  from Dashboard tab and now I want to use that dashboard in my vf Page. Can we do this?
I have the error as below when I tried to book in interview:

*Interviewee: This Candidate already assigned to this Job. The Sendout record has not been created.
*Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This Candidate already assigned to this Job. The Sendout record has not been created.: [TR1__Interviewee__c] 

I tried to remove the whole application record and restart it from beginning and it still showing the same error, can anyone please help? 
trigger AccountSync2 on Account (after insert, after update) {

   List<RecordType> rtypes = [Select Name, Id From RecordType 
                 					 where sObjectType='Account' and isActive=true];
    Map<String,String> accountRecordTypes = new Map<String,String>{};
     
        for(RecordType rt: rtypes)
       		 accountRecordTypes.put(rt.Name,rt.Id);
    
    if (trigger.isInsert) {

         for (Account a: Trigger.new ) {
           String LastName, FirstName;
             
           if (a.Contact_Name__c.indexof(' ') == -1) {
                 LastName =  '-';
               	 FirstName = a.Contact_Name__c;
           } else {
                 LastName = a.Contact_Name__c.Substring(a.Contact_Name__c.indexof(' '),a.Contact_Name__c.length());
                 FirstName = a.Contact_Name__c.substring(0,a.Contact_Name__c.indexof(' '));
           }   
        
            
           if (a.RecordTypeId==accountRecordTypes.get('Sales Process')){ 
               		if (a.CreatedById == '005p0000000r5oI') { //Use to determine if Account was created through API || Needs to be changed to '00528000004nP9f' before deploying to Prod
                       Decimal myD = a.Business_ID__c; 
                       Integer newInt = myD.intValue();
                       
                       Contact c = New Contact();
                     
                             c.FirstName = FirstName;
                   			 c.LastName = LastName;
                             c.AccountId = a.id;
                             c.Phone = a.Phone;
                             c.Email= a.Contact_Email__c;
                             c.Phone = a.Contact_Phone__c;
                             c.Business_Id__c = newInt.format().remove(',');
                             c.User_ID__c = a.User_Id__c;
                                
       
              			insert C;
                 	}
         }
    	}
    }
    
    if (trigger.isUpdate) {
      System.debug(Trigger.newMap.keySet());
      List<Account> accountsWithContacts = [select id, User_Id__c, Contact_Name__c, Business_ID__c,Contact_Email__c,Phone,Contact_Phone__c,  (select id, 
                                                                firstname, lastname, email, User_ID__c,Phone,Business_Id__c,MobilePhone from Contacts) 
                                                                from Account where id IN :Trigger.newMap.keySet()];
	  
  List<Contact> contactsToUpdate = new List<Contact>{};
  
 	 for(Account a: accountsWithContacts){
           String LastName, FirstName;
             
           if (a.Contact_Name__c.indexof(' ') == -1) {
                 LastName =  '-';
               	 FirstName = a.Contact_Name__c;
           } else {
                 LastName = a.Contact_Name__c.Substring(a.Contact_Name__c.indexof(' '),a.Contact_Name__c.length());
                 FirstName = a.Contact_Name__c.substring(0,a.Contact_Name__c.indexof(' '));
           }   
         
    
     	if (a.Contacts.isEmpty()) {
        	             Decimal myD = a.Business_ID__c; 
             Integer newInt = myD.intValue();
                       
                       Contact c = New Contact();
                     
                             c.FirstName = FirstName;
                   			 c.LastName = LastName;
                             c.AccountId = a.id;
                             c.Phone = a.Phone;
                             c.Email= a.Contact_Email__c;
                             c.MobilePhone = a.Contact_Phone__c;
                             c.Business_Id__c = newInt.format().remove(',');
                             c.User_ID__c = a.User_Id__c;
            
              contactsToUpdate.add(c);  
                 insert contactsToUpdate;
        }
        for(Contact c: a.Contacts) {
         
              if (a.User_Id__c == c.User_Id__c || true) {
               				 c.Description= c.firstName + ' ' + c.lastname; 
               				 c.FirstName = FirstName;
                   			 c.LastName = LastName;
                  			 c.MobilePhone = a.Contact_Phone__c;
                       		 c.Phone = a.Phone;
                             c.Email= a.Contact_Email__c;
               
   	  			contactsToUpdate.add(c);  
                   update contactsToUpdate;
              }
   	  		
        } 	  
      }
    }   
}

Thanks!
  • September 30, 2016
  • Like
  • 0
Hi All

I have created a script for cmd data loader ,it working before fine.but now it si not working .its showing error like
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process.bat "D:\Test" Invo
iceUpsert
2016-09-10 13:53:18,455 INFO  [main] controller.Controller initLog (Controller.j
ava:389) - Using built-in logging configuration, no log-conf.xml in C:\Program F
iles (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-09-10 13:53:18,467 INFO  [main] controller.Controller initLog (Controller.j
ava:391) - The log has been initialized
2016-09-10 13:53:18,473 INFO  [main] process.ProcessConfig getBeanFactory (Proce
ssConfig.java:103) - Loading process configuration from config file: D:\Test\pro
cess-conf.xml
2016-09-10 13:53:18,649 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinit
ions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file
 [D:\Test\process-conf.xml]
2016-09-10 13:53:18,776 INFO  [InvoiceUpsert] controller.Controller initConfig (
Controller.java:327) - config dir created at D:\Test
2016-09-10 13:53:18,793 INFO  [InvoiceUpsert] controller.Controller initConfig (
Controller.java:355) - The controller config has been initialized
2016-09-10 13:53:18,796 INFO  [InvoiceUpsert] process.ProcessRunner run (Process
Runner.java:116) - Initializing process engine
2016-09-10 13:53:18,797 INFO  [InvoiceUpsert] process.ProcessRunner run (Process
Runner.java:119) - Loading parameters
2016-09-10 13:53:19,665 INFO  [InvoiceUpsert] config.LastRun load (LastRun.java:
96) - Last run info will be saved in file: D:\Test\InvoiceUpsert_lastRun.propert
ies
2016-09-10 13:53:19,686 FATAL [main] process.ProcessRunner topLevelError (Proces
sRunner.java:238) - Unable to run process InvoiceUpsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ProcessInitializ
ationException: Error creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:162)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:100)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:253)
Caused by: com.salesforce.dataloader.exception.ProcessInitializationException: E
rror creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.controller.Controller.setStatusFiles(Contro
ller.java:486)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:124)
        ... 2 more
Caused by: java.io.IOException: Error creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.controller.Controller.validateFile(Controll
er.java:506)
        at com.salesforce.dataloader.controller.Controller.setStatusFiles(Contro
ller.java:483)
        ... 3 more
C:\Program Files (x86)\salesforce.com\Data Loader\bin>

 
We are in need of a custom field to be created on our leads page that will auto-sum the number of logged calls for that particular lead. I connected with the basic SalesForce HelpDesk but they have said due to several custom objects that they are unable to process this request.
Hello all! 
I have a standard object "Account" with a custom field(picklist) "Stato";
I want to create a custom field "Nome account" where the value is an automatic incremental number that is assigned when the picklist value of "Stato" is changed to 'Cliente',  if that number was not already present.
For example "AC 000000" where "000000" must be an autonumber.

Can you help me?

Thank you very much!
Hi,

I have a form which opens up on click of a custom button "Generate Service" on opportunity. After the form is Saved, the user is redirected to the opportunity detail page. When the Button "Generate Service" is clicked again, I want the old form which was saved before to open up again instead of the brand new form. Let me know if this can be done.
  
Hello,

We are creating a custom button (to trigger an event) in SFDC’s Opportunity page for all existing Opportunities.
The button was created in a developer SFDC instance and uploaded as part of a managed package.
 
Challenge:
The custom button is displaying only for newly created records, which are created after app installation and not displaying Older(existing) Opportunity records.
We need to display custom button for all opportunities after installation of app in new SFDC environment.
 
Please share possible options with us, to display custom button in all opportunities after installing app into new SFDC environment.
 
Thanks,
Pavan N
 
Hello,

Is it necessary that the owner of an account which is enabled as customer account should have a Role ?
 
  • August 24, 2016
  • Like
  • 0
global class LoginHistory implements Schedulable
{
global void execute(SchedulableContext ctx) {
        List<LoginHistory> loginHistories = [SELECT ApiType,
                                                    ApiVersion,
                                                    Application,
                                                    Browser,
                                                    ClientVersion,
                                                    Id,
                                                    LoginTime,
                                                    LoginType,
                                                    LoginUrl,
                                                    Platform,
                                                    SourceIp,
                                                    Status,
                                                    UserId
                                            FROM LoginHistory
                                            WHERE LoginTime <: System.now()
                                            AND LoginTime >: System.now().addMinutes(-1)];
        if ( !loginHistories.isEmpty()) {
            List<Cg_LoginHistory__c> lhc = new List<Cg_LoginHistory__c>();
            for (LoginHistory lh: loginHistories) {
                lhc.add(new Cg_LoginHistory__c( ApiType__c       = lh.ApiType ,
                                                ApiVersion__c    = lh.ApiVersion ,
                                                Application__c   = lh.Application ,
                                                Browser__c       = lh.Browser ,
                                                ClientVersion__c = lh.ClientVersion ,
                                                Id__c            = lh.Id ,
                                                LoginTime1__c    = lh.LoginTime1 ,
                                                LoginType__c     = lh.LoginType ,
                                                LoginUrl__c      = lh.LoginUrl ,
                                                Platform__c      = lh.Platform ,
                                                SourceIp__c      = lh.SourceIp ,
                                                Status__c        = lh.Status ,
                                                UserId__c        = lh.UserId
                ));
            }
            insert lhc;
        }
   }
}

 
Hi All,

I have build sample vf page passing the values from vf page to controller using inputtext........But i am getting null value 

Here is my code: 
<apex:page controller="Displayoutput">
<script type="text/javascript">
    function DisplayErr(){
    if(document.getElementById('{!$Component.frm.Num}').value == ''){
    alert("Please fill the Number");
    }
    else{
    callDisplay();
    alert("Perfect");
    }
}
</script>
 <apex:form id="frm">
  <apex:actionFunction action="{!Display}" name="callDisplay"/>
  <apex:outputText value="Enter The Number"/>
  <apex:inputText  id="Num" value="{!text}"/>
  <apex:commandButton value="Validate" onclick="DisplayErr()" />
  Sample Output:
  
 </apex:form>
</apex:page>

Controller: 
Public class Displayoutput{
public string dis{get;set;}
public string text{get;set;}

public String gettext(){
        return text;
    }

public Displayoutput(){

system.debug('Enter in Constructor*****');
system.debug('TEXTVALUE*****'+text);
}

public void Display(){
    system.debug('TEXTVALUE*****'+text);
   
}



}

Pls give suggwestions.............

Adv Thnx
VSK98
  • August 24, 2016
  • Like
  • 0
global  class Batch_SubscriptionCMRRRollup implements Database.Batchable<SObject>{

global Database.QueryLocator start(Database.BatchableContext context) {
    //get all the billing accounts and the related subscriptions
    return Database.getQueryLocator([Select Id,Today_s_MRR__c,(Select Id,Zuora__MRR__c,Zuora__Status__c,Zuora__ServiceActivationDate__c from Zuora__Subscriptions__r) from Zuora__CustomerAccount__c]);
}

global void execute(Database.BatchableContext context, List<Zuora__CustomerAccount__c> listOfBillingAccounts) {

    //Iterate through all the billing accounts
    for(Zuora__CustomerAccount__c iteratingAccount: listOfBillingAccounts){
    
        //Iterate through all the subscriptions
        for(Zuora__Subscription__c iteratingSubscription : iteratingAccount.Zuora__Subscriptions__r){
            
            //add only those active subscriptions
            if((iteratingSubscription.Zuora__Status__c == 'Active' || 
                iteratingSubscription.Zuora__Status__c=='active') &&
                iteratingSubscription.Zuora__ServiceActivationDate__c <=  Date.Today() &&
                iteratingSubscription.Zuora__MRR__c != NULL){
                   iteratingAccount.Today_s_MRR__c += iteratingSubscription.Zuora__MRR__c;
            }
        }
    }
    
    update listOfBillingAccounts;
}

global void finish(Database.BatchableContext context) {}}
Hello everyone,

Can any one explain me,  how to avoid below loop inside loop using map , can any one explain if i would write bellow code, will it get Hit by governer limits. Thanks Advance. 
 
for(String acct : acc)
    {
        List<String> contlist = new List<String>();
        for(Contact c : trigger.new)
        {
            if(acct == c.AccountId)
            contlist.add(c.id);   
        }
       
    }

Thanks 
 
Hi All,
I have a senariou like this, i have  a picklist and a Checkbox  (both custom field). when we select checkbox true then i need to do picklist mandatory?
Please help me.

Thanks,
Rji
Hi All,
My senariou like this .. I have check box and custom date  field when we select checkbox then the record going to save as current date. it was done by workflow field update . But the probleam is Date field is editable.

i want to locked the date field(Custom date) so that no one can change the date.I have make the checkbox read only through Edit Layout  but still it's editable.
 
is there any other way to make the date field read only?

Thanks,
Raji