• Prashant Wayal
  • NEWBIE
  • 154 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 38
    Replies
MyNewBatch:       [this code is correct]

global class MyNewBatch implements Database.Batchable<Sobject> {
    global Database.QueryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator('select id,name from account');
    }
    global void execute(Database.BatchableContext bc,list<Sobject> scope){
        List<Account> acc=new List<Account>();
        for(Sobject x:scope ){
           Account a=(Account) x;
            a.name ='Mr'+a.name;
            acc.add(a);
        }
        update acc;
    }
    global void finish(Database.BatchableContext bc){
        
    }
}
MySchedule :  [this program also related to above program tjhis one also corrrect and execute]
global class MySchedule implements Schedulable{
    global void execute(SchedulableContext sc){
        MyNewBatch mb = new MyNewBatch();
        Database.executebatch(mb);
    }
}
TestSchedule :[this program have an error ]
public class TestSchedule {
       public PageReference show(){
           String timeframe ='0 10 8 10 * ?';
        MySchedule ms= new MySchedule();
        System.schedule('MyJob', timeframe, ms); //Error: Non-void method might not return a value or might have statement after a return statement.
       
        }
}

Vf Page:
<apex:page  contentType="TestSchedule">
    <apex:form>
    <apex:commandButton value="click" action="{!show}"/>
    </apex:form>
</apex:page>
My answer is A and B. But conflicting with someone else answer.
What should be considered when configuring the lead conversion process?
Choose 2 answers
a. Standard lead fields are automatically converted into account, contact and opportunity fields
b. Custom Lead fields can be mapped to custom object fields.
c. Custom Lead fields can be mapped to account, contact and opportunity fields
d. Roll-up Summary Lead Fields can be mapped to custom contact fields.
  • August 25, 2015
  • Like
  • 0
I created a test class and getting an error message:
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, The pricebook entry is inactive.: [PricebookEntryId]

Below is the class
public string QuoteRefresh1(string sQuoteId){
       String sQuoteAccountId=[SELECT Pelco_Account_Name__c FROM Quote where Id=:sQuoteId].Pelco_Account_Name__c;
       system.debug('sQuoteAccountId='+sQuoteAccountId); 
       String CustomerNumber=[SELECT Customer_Number__c FROM Account WHERE Id =:sQuoteAccountId].Customer_Number__c;
       system.debug('CustomerNumber='+CustomerNumber); 
       for(QuoteLineItem pi:[SELECT CreatedById,CreatedDate,Description,Id,IsDeleted,LastModifiedById,LastModifiedDate,LineNumber,ListPrice,PricebookEntryId,Product2Id,Product2.Item__c,Quantity,QuoteId,SortOrder,Subtotal,SystemModstamp,TotalPrice,UnitPrice,Currency__c,Dealer_Price__c,Regular_Price__c FROM QuoteLineItem  where QuoteId =:sQuoteId])
       {
           string sProduct2Id= pi.Product2Id;
           String ItemNumber= pi.Product2.Item__c ;
           system.debug('ItemNumber='+ItemNumber);
            //calculating prices, discounts and currency
           CalculatePelcoDiscount1 NewDiscount= new CalculatePelcoDiscount1();
           double PelcoDiscount=NewDiscount.CalculatePelcoDiscount1(ItemNumber,CustomerNumber );
           CalculatePelcoPrice newPrice=new CalculatePelcoPrice();
           double pelcoPrice=newPrice.CalculatePelcoPrice(ItemNumber,CustomerNumber );
           string pelcoCurrency=newPrice.CalculatePelcoCurrency(CustomerNumber);
           pi.Currency__c=pelcoCurrency;
           system.debug('pelcoCurrency='+pelcoCurrency);
           pi.Dealer_Price__c=pelcoPrice;
           system.debug('pelcoPrice='+pelcoPrice);
           pi.Discount=PelcoDiscount;
           system.debug('PelcoDiscount='+PelcoDiscount);
           //pi.Discounted_Price__c=100;
           //adding records to the list
           items.add(pi);
       }
       if(items.size() > 0 )
        {
            update items;
        }
           return ('Success');  
   }
  }//end class

and test class
@istest
private class TestQuoteRefresh1 {
    static testMethod void testQR1() {
//create Price book
        /*Pricebook2 pb=new Pricebook2();
        pb.IsActive=true;
        pb.Name='test';
        insert pb;*/
        //Create Account
        Account a = new Account();
    	a.Name = 'Ritzy';
    	insert a;
        Account b=new Account();
        b.Name='Testb';
        insert b;
        
        //Create Opportunity
        Opportunity opty=new Opportunity();
		opty.Name='Test Opportunity';
        opty.StageName='Prospecting';
        opty.CloseDate=date.valueof('2015-09-10');
        opty.AccountId=a.Id;
        //opty.Pelco_Account_Name__c=PA.id;
		Insert opty; 
        
        //Create pelco account
        Pelco_Account__c PA =new Pelco_Account__c();
        PA.Name='Ritzy';
        //PA.OpportunityId=Opty.id; 
        PA.AccountName__c=a.Id;
        PA.OpportunityName__c=Opty.id;
        Insert PA;
         Id priceBookId = Test.getStandardPricebookId();
         //Insert Quote
        Quote q =new Quote();
         q.name='Test Quote';
         q.opportunityId=opty.id;
         q.Pelco_Account_Name__c=b.id;
         q.Pricebook2Id=priceBookId;
        insert q; 
       
        //insert Quote Line Item
        Product2 prod = new Product2(
			 Name = 'ENGEH16-2P',
			 ProductCode = 'ENGEH16-2P',
			 Item__c = 'ENGEH16-2P',
             Discount_Code__c='A',
			 isActive = true,
            Dealer_Price__c=100 
		);
		insert prod;
        //create price book entry
        PricebookEntry PBE= new PricebookEntry();
        //PBE.Name='ENGEH16-2P';
        PBE.Pricebook2Id=priceBookId;
        PBE.Product2Id=prod.id;
        PBE.UnitPrice=100;
        Insert PBE;
        //Create Quote Item 1
        QuoteLineItem QLI= new QuoteLineItem();
        QLI.Currency__c='USD';
        QLI.Dealer_Price__c=100;
        QLI.Discount=20;
        //QLI.Discounted_Price__c=70;
        //QLI.Incremental_Discount__c=10;
        //QLI.ListPrice=200;
        QLI.PricebookEntryId=PBE.Id;
        QLI.Product2Id=prod.id;
        QLI.Quantity=1;
        QLI.QuoteId=q.Id;
        //QLI.TotalPrice=100;
        QLI.UnitPrice=100;
        Insert QLI;
     QuoteRefresh1 QRefresh=new QuoteRefresh1();
     QRefresh.QuoteRefresh1(q.Id);
    }
}

You can see from the print screen that price book entry is active
User-added image
trigger TaskCompletedTrigger on Task (before update ) {
Set ownerIds = new Set();
for(Task tsk: Trigger.New){
if(tsk.Status=='Completed'    && Trigger.oldMap.get(tsk.Id).Status != 'Completed'){
ownerIds.add(tsk.CreatedById);
}
}
Map userMap = new Map([select Name, Email from User where Id in :ownerIds]);
Map mapCase = new Map([SELECT Id,Email__c,CaseNumber,Case_Request_Type__c,CreatedDate,Status,Description,Type,Subject,Contact.Name,Contact.Email,Contact.MobilePhone  FROM Case]);
List emailMsglist=new List();
for(Task tsk : Trigger.New) {
Case caseObj  = mapCase.get( tsk.WhatId );
if(tsk.Status=='Completed' && Trigger.oldMap.get(tsk.Id).Status != 'Completed'){
User theUser = userMap.get(tsk.CreatedById);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {theUser.Email};
mail.setToAddresses(toAddresses);    
mail.setSubject('A task has been updated');     
String template = 'Hello {0}, \nYour task has been Completed. Here are the details - \n\n';
template+= 'CASE- {1}\n';
template+= 'Subject - {2}\n';
template+= 'Due Date - {3}\n';
template+= 'Comments - {4}\n';
template+= 'Status - {5}\n';
String duedate = '';
String Commentsdes = '';   
if (tsk.ActivityDate==null) 
duedate = '';
if (tsk.Description==null )
Commentsdes = 'No Comments';
else
duedate = tsk.ActivityDate.format();
Commentsdes = tsk.Description;  
List args = new List();
args.add(theUser.Name);
args.add(mapCase.get(tsk.WhatId).CaseNumber);
args.add(tsk.Subject);
args.add(duedate);
args.add(tsk.Description);
args.add(tsk.Status);


String formattedHtml = String.format(template, args);
mail.setPlainTextBody(formattedHtml);
emailMsglist.add(mail);

}      
}
Messaging.SendEmail(emailMsglist);

}

Hi All,

I am new to salesforce so please help me to find the solution.

My problem is that, I want to use the SOAP callouts such as DescribeTabs(), DescribeLayouts(), etc through Apex to get all the Apps available to the logged in user. Is there any way to do this. If Yes then please give the solutions. Looking for your help.

 

Hi All,
 Help Me out, am completely stuck here since last few days.
I have done everything perfect role, profile, Permission but not able to pass the test method.
here the screenshot.
User-added image
 
hi, 
i'm trying to update permission set from apex code  but still it's not working can anyone help me out !
String parameterValue = ApexPages.currentPage().getParameters().get('Permission_Set_ID'); //Permission_Set_ID from the URL for reference 






         }
      }  
   }
       public pagereference Assign()   //assign of user difend permissions
              {
            if(selectedValue == 'readselected')          
             {
              //update Object permission for Opportunity 
                PermissionSet ps =[select id,ProfileId,SystemModstamp,UserLicenseId FROM PermissionSet where id='parameterValue '];
                ObjectPermissions op = new ObjectPermissions();
                op.parentid          = ps.id;
                op.SobjectType       = 'Opportunity';  
                op.PermissionsCreate = false;
                op.PermissionsRead   = true;
                op.PermissionsEdit   = false;
                insert op;
                 } 
          return null;
        
     }
     }

 
Work for a company named to Inc. 500’s list three times, and named a top workplace by Modern Healthcare!!  $85K + free lunch, beer and paid benefits...what could be better?!

Our client is looking for a Jr. Salesforce Administrator in the Cleveland Area to contribute to a variety of larger systems projects, including CRM, contract management, and other applications built on the Force.com platform.  If interested please contact me at nancy@tech2resources.com
Hello I am in need for a advance developer and the developer should be able to understand the requirement and then perform the job, fast pased, should be able to teach and explain the best ways of the code. Please let me know if you anyone is interested. Along with the VF pages it also has Apex development. exisitng system is developed from Access and SQL server DB and Oracle. Integration with different enviornments also needs to be done. not too comlicated integration but a simple one.

In need of 2-4 hours daily work including weekends. 

If any one has previous experience please let me know.
Hi Everyone,
I am looking for Salesforce Developer Job Support based in USA time zone and preferably from the USA. Need help with apex coding, triggers, workflows etc. Please reply back here or email me at mia.p827@gmail.com with the subject line: SFDC Job Support
Thanks.
  • September 19, 2015
  • Like
  • 0
We are Transcend Insights, the technology division of Humana.  It is a dyamic orgainizaton on the forefront of Population Health, the next frontier in technology.
Location San Jose,CA or San Diego, CA
Assignment Capsule
The Transcend Insights Salesforce Administrator will be responsible for owning, developing, and executing configuration, reporting, training, support, maintenance and improvement of the Salesforce CRM platform. The Administrator will be the liaison between Executive Management, Client Services, Sales & Marketing, Humana Corporate, and work with all end-users to ensure the applications meets expectations and to continually improve the system.
 
Responsibilities
  • Owner of Salesforce environment and primary Salesforce administrator.
  • Implement enhancements and roll out new features. Maintain a clean and efficient user interface
  • Execute solution design activities such as data mapping, object modelling, page layout design and rule logic definition in the context of the Salesforce application, including 3rd party app exchange applications
  • Create training materials and user documentation, and maintain such documentation as business needs evolve.
  • Design, develop and maintain all company, team, and individual dashboard metrics. Design and develop workflow rules, validation rules, email notifications, etc.
  • Data Management: complete mass data imports/exports as needed using the API tool, lead management, audit and resolve data integrity issues such as merging duplicate records and establishing proper ownership of existing accounts and contacts in accordance with sales territories.
  • Consult with all stakeholders to improve business processes, including developing functionality to automate manual processes.
  • Add, configure and train new Salesforce users, including integration of existing remote users currently in different Salesforce Orgs.
  • Maintain security user roles and profiles, security settings, access settings, etc.
  • Test and QA of enhancements/changes using sandbox.
  • Develop and maintain Customer Portal.
  • Maintain Salesforce.com release documentation
  • Establish and implement best practice procedures for system maintenance and optimization, configuration development, testing, data integrity, backups, etc.
  • Support of strategic objectives for Transcend Insights
  • Fosters close, cooperative relationships with peer leaders, sales management, and sales support personnel.
  • Accountable for the on-time implementation of assigned projects.
Role Essentials
  • Four year college degree from an accredited institution.
  • Two years in a business-to-business sales environment.
  • Demonstrated proficiency managing analytically rigorous initiatives.
  • Experience in Salesforce 
Please apply at the follwoing Link: H (https://humana.taleo.net/careersection/externalus/jobdetail.ftl?job=147640⟨=en)umana/Transcend Insights Salesforce Business Analyst/Administrator
MyNewBatch:       [this code is correct]

global class MyNewBatch implements Database.Batchable<Sobject> {
    global Database.QueryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator('select id,name from account');
    }
    global void execute(Database.BatchableContext bc,list<Sobject> scope){
        List<Account> acc=new List<Account>();
        for(Sobject x:scope ){
           Account a=(Account) x;
            a.name ='Mr'+a.name;
            acc.add(a);
        }
        update acc;
    }
    global void finish(Database.BatchableContext bc){
        
    }
}
MySchedule :  [this program also related to above program tjhis one also corrrect and execute]
global class MySchedule implements Schedulable{
    global void execute(SchedulableContext sc){
        MyNewBatch mb = new MyNewBatch();
        Database.executebatch(mb);
    }
}
TestSchedule :[this program have an error ]
public class TestSchedule {
       public PageReference show(){
           String timeframe ='0 10 8 10 * ?';
        MySchedule ms= new MySchedule();
        System.schedule('MyJob', timeframe, ms); //Error: Non-void method might not return a value or might have statement after a return statement.
       
        }
}

Vf Page:
<apex:page  contentType="TestSchedule">
    <apex:form>
    <apex:commandButton value="click" action="{!show}"/>
    </apex:form>
</apex:page>
Hi,
My question is : If i checked the checkbox then both fields will appear and if the checkbox is unchecked then both field will not appear.User-added image
Hi,

I have create a rich text area custom field. In this field allow to image also. Then how to check the rich text area is null or not when image is displayed. Any one know reply it.
Hello,

Our company is one of the biggest Bookseller in Brazil. We would create an online e-commerce site with 700 000 products.
But we have no computer skills. So we want a lasting relationship with a service provider (preferably independent).

If you are interested, thank you to send us some reference to the email livre.livro@CoolRio.com
 
here is my cntroller code
 public with sharing class TwilioCloudCommunicationClass {  
      
    // Public Properties  
    public String SelectedMobileNumber{get;set;}  
    public String OtherMobileNumber{get;set;}  
    public String textMessage{get;set;}
    // Default construtor  
    public TwilioCloudCommunicationClass()  
    {  
        SelectedMobileNumber  = '' ;  
        OtherMobileNumber = '' ;  
    }  
      
    Public List getPersonList()  
    {  
        Try{  
            List localList = new List();  
            localList.add(new SelectOption('' , '--Select--'));  
            for(contact cont : [select Name,MobilePhone from contact where TwilioRegisteredUser__c = true ])  
            {  
                localList.add(new SelectOption(cont.MobilePhone , cont.Name));            
            }        
            localList.add(new SelectOption('other' , 'Other'));  
            return localList ;  
        }  
        
        catch(Exception e)  
        {  
            ApexPages.addMessages(e);        
            return null;  
        }  
        
    }  
      
    public void SendSMS()  
    {  
        Try{        
            SelectedMobileNumber = (SelectedMobileNumber == '')? OtherMobileNumber:SelectedMobileNumber ;  
            if(SelectedMobileNumber != '')  
            {  
                List AdminInfo = TwilioConfig__c.getall().values();  
                String ACCOUNT_SID = '';  
                String AUTH_TOKEN  = '' ;              
                String SenderMobileNumber = '' ;  
                // Informaton getting from custom setting  
                if(AdminInfo.size()>0)  
                {            
                    ACCOUNT_SID             = AdminInfo[0].AccountSid__c;  
                    AUTH_TOKEN              = AdminInfo[0].AuthToken__c;                  
                    SenderMobileNumber      = AdminInfo[0].Admin_Mobile_Number__c;      
                }              
                TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);  
                 
                Map properties = new Map {  
                            'To'   => SelectedMobileNumber ,  
                            'From' => SenderMobileNumber,  
                            'Body' => textMessage  
                    };  
                TwilioSMS message = client.getAccount().getSmsMessages().create(properties);  
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, 'Message has been sent'));  
            }  
            else  
            {  
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error, 'Pelase provide valid Mobile Number '));  
            }  
        }catch(Exception e )  
        {  
            ApexPages.addMessages(e);        
            return ;  
        }    
    }       
    } 
Can anyone help me to solve this?
I'm working with 2 app, it connect to one object is Cus_Product.

When i insert Cus_Product from app1, i can see that product on app2 and when i insert Cus_Product from app2, i can see that product on app1.
I want when i insert on app1, i can only see data that i inserted from app1, not display data that i inserted form app2.

How can i do that?
My answer is A and B. But conflicting with someone else answer.
What should be considered when configuring the lead conversion process?
Choose 2 answers
a. Standard lead fields are automatically converted into account, contact and opportunity fields
b. Custom Lead fields can be mapped to custom object fields.
c. Custom Lead fields can be mapped to account, contact and opportunity fields
d. Roll-up Summary Lead Fields can be mapped to custom contact fields.
  • August 25, 2015
  • Like
  • 0
We have a custom built Visualforce page that was created to allow our users to mass email contacts. Currently, when a user creates a list view of contacts to email and clicks the "Send Email" button, they receive an error saying, "Collection Size 16,972 exceeds maximum size of 1,000."

When I go under Setup --> Administer --> Communication Templates -->  Email Templates, I can see that there are thousands of email template for mass emails that were sent using Marketo. Everytime a user sends a mass email using the "Send Marketo Email" button, a template is added to the "Marketo Email Templates" folder. So, if a user sends a Marketo Email to 5 contacts, 5 templates are added to the folder.

I am not a developer, so I am confused as to why each email adds a template to this "Marketo Email Templates" folder. 
HI Friends,

    Can you please help me how to integrate salesforce with gotowebinar. My requirement is, from my salesforce instance, I need to create registrants and attendees in gotowebnar.

   I found some appexchange packages but I want to do develop this integration in a customized  way.

   Please help me. If you need any more information please let me know.
Hi!

Im searching for a qualified web and sales force developer, that can handle a complete integration of a classified web site into sales force. I need him to integrate also a contact form that generates leads for the classified web site. I also need him to integrate a fully monitored and tracking solution for everything whats going on on the web site, to make a complete analytics of the leads.

I also want to integrate adstage and clickmeter in my salesforce, because I need to make a complete lead source analytics data sheet, because I need to send reports of the generated leads to my clients.

If possible in a backend client area, where a monthly overview and report is built as pdf or client interface, where clients can login and check whats going on.

I prefure using following software for ads automation and complete tracking and monitoring:

+ Clickmeter
+ Adstage
+ Marketing360


thanks