• Aki99
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 11
    Replies
Hi,
I want to create a trigger on contact object in force.com which fires after insert in contact and add that inserted contact detail to the logged in user's skype profile.
Any idea how can I achieve the same. Also I want to do this without installing any 3rd party/external app from app exchange.
Can we access skype APIs directly from apex classes, if so how?
Thanks in advance
  • June 02, 2014
  • Like
  • 0

Hi,
I am trying to use a nested retrieve in the script for visualforce remote objects, but unable to achieve the same.
M using the following code for the same but the output shows nothing

<apex:remoteObjectModel name="Question__c" jsShorthand="Ques" fields="Id,Name,Title__c">
        <apex:remoteObjectField name="Option_1__c" jsShorthand="opt1"/>
        <apex:remoteObjectField name="Option_2__c" jsShorthand="opt2"/>
        <apex:remoteObjectField name="Option_3__c" jsShorthand="opt3"/>
        <apex:remoteObjectField name="Option_4__c" jsShorthand="opt4"/>
    </apex:remoteObjectModel>

    <apex:remoteObjectModel name="Student_Test__c" jsShorthand="Stest" fields="Name">
        <apex:remoteObjectField name="Question__c" jsShorthand="Ques"/>
        <apex:remoteObjectField name="Score__c" jsShorthand="Scor"/>
        <apex:remoteObjectField name="SelectedOption__c" jsShorthand="Selopt"/>
    </apex:remoteObjectModel>

<script>
start =  function(){

      var qt= new SObjectModel.Ques();
      var sco = new SObjectModel.Stest();
  
      qt.retrieve({limit:1},function(err, data){

        if(err==null){
          var divql = document.getElementById("div_ql");
         
          if(data.length==0){
            var divql = document.getElementById("div_ql");
           
            var ques_head= document.createElement("h1");
            ques_head.appendChild(document.createTextNode('End of File'));
            divql.appendChild(ques_head);
           
            sco.retrieve({limit:1},function(er,rec){
              if(er==null){
                if(rec.length!=0){
                  rec.forEach(function(dt) {
                    var sc = rec.get("Scor");
                    var st_score= document.createElement("h3");
                    st_score.appendChild(document.createTextNode('Score: '+sc)); 
                    divql.appendChild(st_score);
                  }
                }
               
              }
              else{
                alert("Error at EOF");
              }
            });
          }
        }
      }
    }
 

  • May 01, 2014
  • Like
  • 0
Hi,
I am trying to delete all records in my sObject using Bulk API in java.
I am using the following code for the same:
private JobInfo createJob(String sobjectType, BulkConnection connection) throws AsyncApiException {
       
        JobInfo job = new JobInfo();
       
        job.setObject(sobjectType);
        job.setOperation(com.sforce.async.OperationEnum.delete);
        job.setContentType(ContentType.CSV);
       
       
        job = connection.createJob(job);
       return job;
}
code from :http://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_code_walkthrough.htm
I am using a csv with ids of all the records to be deleted.
When I run the code it gives me the error as : "ENTITY_IS_DELETED:entity is deleted:--"

Any idea how can I overcome the above error?

Thanks in advance,

Regards,
Aakash
  • April 07, 2014
  • Like
  • 0
I have a permission set which restricts its assigned users to edit some fields of a record. I want to assign this permission set to rest of the users which are selected by the record owner using the visualforce page.
When the record owner creates the record he is asked to give permissions to rest of the users for his newly created record to either read or read/write. And thus accordingly assign permission sets to the selected users.

Any idea how can I achieve the same?

Thanks in advance,
Aakash Jain
  • December 25, 2013
  • Like
  • 0

Hi,

I want to use images in place of default checkbox in salesforce. So that when the user clicks on the image its corresponding checkbox gets selected at the back end.Any idea how can I achieve that in visualforce??

 

Thanks in advance

 

Regards,

Aakash

  • November 27, 2013
  • Like
  • 0

Hi,

I want to pass a default path value for the inputFile tag in uploading an attachment to the record. By default it opens the documents folder but how can I customize the location where it looks for the uploading document by default.

I am using the following code to upload the document

<apex:page controller="AttachmentUploadController">
<apex:form >
<apex:outputText value="Parent Object ID: "/><apex:inputText value="{!parentId}"/><br/>
<apex:outputText value="Input File: "/><apex:inputFile value="{!attach.body}" filename="{!attach.name}" /><br/>
<apex:commandButton value="Upload" action="{!upload}"/>
</apex:form>
</apex:page>

Controller


public with sharing class AttachmentUploadController
{
public String parentId {get;set;}
public Attachment attach {get;set;}

public AttachmentUploadController()
{
attach = new Attachment();
}

public ApexPages.Pagereference upload()
{

attach.ParentId = parentId;
insert attach;

return new ApexPages.Standardcontroller(attach).view();
}
}

when I click on browse it opens the c drive while I want it to be opened in d: by default

 

Also is it possible that we can define a file name which is automatically uploaded from the location on any event or time based trigger??

Any ideas how can I achieve the same?

 

Thanks in advance,

Aakash

  • November 09, 2013
  • Like
  • 1

Hi,

I want to open a popup page in my custom visualforce at an event and when the user clicks on the submit button the popup page closes and rest of the parent page components are rendered true.

I was able to open the poppage and also to close that after submit but how can i render the rest components of the parent page to true after submit?

Any ideas will be helpful

 

Thanks in advance

 

Aakash

  • October 09, 2013
  • Like
  • 0

Hi ,

I want to add a custom html template to a pageblock in my custom VF page.

Also I want to make the user add the recievers manually which are not even in contact.

How I can do so?

And is there any possible way to create SimpleRichtextMail as like SimplePlaintextMail in which we can add an image in the email body

I am stuck trying to add image i in custom email

Thanks in advance

  • August 01, 2013
  • Like
  • 0

Hi all,

I am tring to develop an VF PAge which shows a list of books in pageblocktable.

Each row shows the data for a book record.

I want to get to the next page(the detail page) for the book selected by clicking on the command button in its row.

How to get that id of the selected book among all the idds in the table.

One idea is by using wrapper class but i am a newbie and don't know how to do this using that

Thanks in advance

  • August 01, 2013
  • Like
  • 0

Hi there,
I am trying to create a dependent picklist in a visual force page.
The first lists the price range of books and the second then lists the author list.
But when I try to add items to the second list by the code:
str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c<100 AND author__c =:this.options1]

it gives me the following error
: Invalid bind expression type of System.SelectOption for column of type String at line 26 column 117

here's my controller code
public class class12
{

    public string options ;
    public List<selectOption> options1 = new List<selectoption>();
    public string options2;
    public List<Novel__c> str = new List<Novel__c>();
   
    public class12(ApexPages.StandardController controller)
    {

    }

    public List<Novel__c> getStr() {

            if(options=='Below 100')
            { 
                options1.clear();
                for(Novel__c n:[SELECT author__c FROM Novel__c WHERE price__c<100 ORDER BY author__c])
                { 
                    this.options1.add(new SelectOption(String.valueof(n.author__c),string.valueof(n.author__c)));
                }
                getItems2();
               
                str.clear();
                str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c<100 AND author__c =:this.options1];
                return str;
            }
            else if(options == 'Above 100'){
                options1.clear();
                for(Novel__c n:[SELECT author__c FROM Novel__c WHERE price__c<100 ORDER BY author__c])
                { 
                    this.options1.add(new SelectOption(String.valueof(n.author__c),string.valueof(n.author__c)));
                }
                getItems2();
                str.clear();
                str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c>=100 AND author__c =:this.options1];
                return str;
            }
           else{ 
                //getItems2(null);
                str.clear();
                return str;
           }
          
    }


    public List<SelectOption> getitems2()
    {
        return this.options1;
    }
    public List<Novel__c> getnovelList()
    {
        return [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c>100];
    }
    public string getoptions()
    {
        return this.options;
    }
    public void setoptions(String opt)
    {
        this.options = opt;
    }
    public string getoptions2()
    {
        return this.options2;
    }
    public void setoptions2(String opt)
    {
        this.options2 = opt;
    }
    public List<SelectOption> getItems()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new Selectoption('Below 100','Below 100'));
        options.add(new Selectoption('Above 100','Above 100'));      
        return options;
    }
    public pagereference preview()
    {
        return null;
    }
}
Is there any other way of adding a string variable in select list?
Thank you

  • July 31, 2013
  • Like
  • 0

Hi,

I have divided all my users into 2 roles (say role1 and role2)

M working with two objects obj 1 & users

a field named "role" in obj1 is getting its value using lookup to users object

But when i use the lookup i see the list of all available users

I want to restrict the list in the lookup to only the users assigned to role1

similarly i have another field in obj1 looking up to users for list of users with role2

How can i do this in my app

  • July 24, 2013
  • Like
  • 0

Hi,

I want to pass a default path value for the inputFile tag in uploading an attachment to the record. By default it opens the documents folder but how can I customize the location where it looks for the uploading document by default.

I am using the following code to upload the document

<apex:page controller="AttachmentUploadController">
<apex:form >
<apex:outputText value="Parent Object ID: "/><apex:inputText value="{!parentId}"/><br/>
<apex:outputText value="Input File: "/><apex:inputFile value="{!attach.body}" filename="{!attach.name}" /><br/>
<apex:commandButton value="Upload" action="{!upload}"/>
</apex:form>
</apex:page>

Controller


public with sharing class AttachmentUploadController
{
public String parentId {get;set;}
public Attachment attach {get;set;}

public AttachmentUploadController()
{
attach = new Attachment();
}

public ApexPages.Pagereference upload()
{

attach.ParentId = parentId;
insert attach;

return new ApexPages.Standardcontroller(attach).view();
}
}

when I click on browse it opens the c drive while I want it to be opened in d: by default

 

Also is it possible that we can define a file name which is automatically uploaded from the location on any event or time based trigger??

Any ideas how can I achieve the same?

 

Thanks in advance,

Aakash

  • November 09, 2013
  • Like
  • 1
Hi,
I am trying to delete all records in my sObject using Bulk API in java.
I am using the following code for the same:
private JobInfo createJob(String sobjectType, BulkConnection connection) throws AsyncApiException {
       
        JobInfo job = new JobInfo();
       
        job.setObject(sobjectType);
        job.setOperation(com.sforce.async.OperationEnum.delete);
        job.setContentType(ContentType.CSV);
       
       
        job = connection.createJob(job);
       return job;
}
code from :http://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_code_walkthrough.htm
I am using a csv with ids of all the records to be deleted.
When I run the code it gives me the error as : "ENTITY_IS_DELETED:entity is deleted:--"

Any idea how can I overcome the above error?

Thanks in advance,

Regards,
Aakash
  • April 07, 2014
  • Like
  • 0
I have a permission set which restricts its assigned users to edit some fields of a record. I want to assign this permission set to rest of the users which are selected by the record owner using the visualforce page.
When the record owner creates the record he is asked to give permissions to rest of the users for his newly created record to either read or read/write. And thus accordingly assign permission sets to the selected users.

Any idea how can I achieve the same?

Thanks in advance,
Aakash Jain
  • December 25, 2013
  • Like
  • 0

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

I want to know what is the best way to send selected recordIds from the VF Page to the Controller.

 

Hi,

I want to use images in place of default checkbox in salesforce. So that when the user clicks on the image its corresponding checkbox gets selected at the back end.Any idea how can I achieve that in visualforce??

 

Thanks in advance

 

Regards,

Aakash

  • November 27, 2013
  • Like
  • 0

Hi,

I want to open a popup page in my custom visualforce at an event and when the user clicks on the submit button the popup page closes and rest of the parent page components are rendered true.

I was able to open the poppage and also to close that after submit but how can i render the rest components of the parent page to true after submit?

Any ideas will be helpful

 

Thanks in advance

 

Aakash

  • October 09, 2013
  • Like
  • 0

Hi all,

I am tring to develop an VF PAge which shows a list of books in pageblocktable.

Each row shows the data for a book record.

I want to get to the next page(the detail page) for the book selected by clicking on the command button in its row.

How to get that id of the selected book among all the idds in the table.

One idea is by using wrapper class but i am a newbie and don't know how to do this using that

Thanks in advance

  • August 01, 2013
  • Like
  • 0

Hi there,
I am trying to create a dependent picklist in a visual force page.
The first lists the price range of books and the second then lists the author list.
But when I try to add items to the second list by the code:
str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c<100 AND author__c =:this.options1]

it gives me the following error
: Invalid bind expression type of System.SelectOption for column of type String at line 26 column 117

here's my controller code
public class class12
{

    public string options ;
    public List<selectOption> options1 = new List<selectoption>();
    public string options2;
    public List<Novel__c> str = new List<Novel__c>();
   
    public class12(ApexPages.StandardController controller)
    {

    }

    public List<Novel__c> getStr() {

            if(options=='Below 100')
            { 
                options1.clear();
                for(Novel__c n:[SELECT author__c FROM Novel__c WHERE price__c<100 ORDER BY author__c])
                { 
                    this.options1.add(new SelectOption(String.valueof(n.author__c),string.valueof(n.author__c)));
                }
                getItems2();
               
                str.clear();
                str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c<100 AND author__c =:this.options1];
                return str;
            }
            else if(options == 'Above 100'){
                options1.clear();
                for(Novel__c n:[SELECT author__c FROM Novel__c WHERE price__c<100 ORDER BY author__c])
                { 
                    this.options1.add(new SelectOption(String.valueof(n.author__c),string.valueof(n.author__c)));
                }
                getItems2();
                str.clear();
                str = [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c>=100 AND author__c =:this.options1];
                return str;
            }
           else{ 
                //getItems2(null);
                str.clear();
                return str;
           }
          
    }


    public List<SelectOption> getitems2()
    {
        return this.options1;
    }
    public List<Novel__c> getnovelList()
    {
        return [SELECT name,price__c,author__c,publisher__c FROM Novel__c WHERE price__c>100];
    }
    public string getoptions()
    {
        return this.options;
    }
    public void setoptions(String opt)
    {
        this.options = opt;
    }
    public string getoptions2()
    {
        return this.options2;
    }
    public void setoptions2(String opt)
    {
        this.options2 = opt;
    }
    public List<SelectOption> getItems()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new Selectoption('Below 100','Below 100'));
        options.add(new Selectoption('Above 100','Above 100'));      
        return options;
    }
    public pagereference preview()
    {
        return null;
    }
}
Is there any other way of adding a string variable in select list?
Thank you

  • July 31, 2013
  • Like
  • 0

Hi Everyone,

 

I'm new to VisualForce Pages and Salesforce in general.  I need an visual page that shows a dependent picklist from an object.  The picklist goes down 3 levels.  My custom fields are brand, product line, and subproduct line. Right now I can see the page but my picklists have no values.  I know I need a controller and maybe a wrapper class but im not sure where to insert it.

 

*I found this code online and just tweaked as per my specs.

 

My Controller 

 

public with sharing class MyController {

public string currentBrand { get; set; }
public string currentPline { get; set; }
public string currentSpline { get; set; }

public MyController() {
currentBrand = currentPline = currentSpline = null;
}

 

public List<SelectOption> getListBrand() {
List<SelectOption> options = new List<SelectOption> { new SelectOption('','-- Choose --') };
for(Schema.PicklistEntry pe:Product2.Family.getDescribe().getPicklistValues()) {
options.add(new SelectOption(pe.getValue(),pe.getLabel()));
}
return options;
}


public List<SelectOption> getListPline() {
List<SelectOption> options = new List<SelectOption> { new SelectOption('','-- Choose --') };
for(Schema.PicklistEntry pe:Product2.Family.getDescribe().getPicklistValues()) {
options.add(new SelectOption(pe.getValue(),pe.getLabel()));
}
return options;
}

public List<SelectOption> getListSpline() {
List<SelectOption> options = new List<SelectOption>();
if(currentPline == null || currentPline == '')
return options;
options.add(new SelectOption('','-- Choose --'));
for(Product2 p2:[select id,name from product2 where family = :currentPline]) {
options.add(new SelectOption(p2.id,p2.name));
}
return options;
}

}

 

VForce page:


<apex:page controller="MyController">
<apex:form id="theForm">
<apex:sectionHeader title="Choose Product Line"/>
<apex:pageBlock title="Demo Page">
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel >Product Line</apex:outputLabel>
<apex:selectList size="1" multiselect="false" value="{!currentPline}">
<apex:selectOptions value="{!ListPline}"/>
<apex:actionSupport reRender="theForm" event="onchange"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Sub-Product</apex:outputLabel>
<apex:selectList value="{!currentSpline}" size="1" multiselect="false">
<apex:selectOptions value="{!listProducts}"/>
<apex:actionSupport reRender="theForm" event="onchange"/>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Can anyone help me out?

Thanks for the help in advance,

Hkp716

  • October 07, 2012
  • Like
  • 0

I'm creating a document request form wizard for my organization through Visualforce, and I have a couple of things I want to do with the url parameters.

 

1. How do I automatically get the Opportunity Id parameter value to get passed to Step 1 of the wizard when I'm in an opportunity and I click on a custom button for the wizard?

 

2. How do I pass the Opportunity Id parameter between pages. 

 

For example, the wizard has 4 pages and starts on Step 1 with an Id parameter in it's url (http://...force.com/apex/...?id=_____); what I want to be able to do is pass the same parameter value onto the next few pages when I click the "Next" command button, and also be able to traverse the function when I click the "Previous" command button. 

 

3. Lastly, one of the pages, Step 2, uses the Contact standardController rather than the Opportunity standardController, and therefore takes in a different Id parameter value. How can I get the ContactId parameter value from the linked Opportunity?

I am working on a project where there are both Salesforce and custom Visualforce pages. I want to know if it is possible to change the title of the page (<title></title>) that is displayed when i mouse over on the tab .  I want this either on Visualforce pages or on standard Salesforce pages.

 

Any help will be appreciated.

Hi,

 

If i am having pageblocktable and button control in a page.

 

when i click that button I need to send mail for pageblocktable records as a PDF format.

 

I tried like

 

 


<apex:page controller="sendEmail">
<apex:form>
<apex:pageblockTable value="{!Activities}" var="c" id="results" > <apex:column > <apex:facet name="header"> <apex:inputCheckBox value="{!selectAllCheckbox}" onclick="checkAll(this)"> <apex:actionSupport event="onclick" action="{!selectAll}" rerender="results"/> </apex:inputCheckBox> </apex:facet> <apex:inputCheckBox value="{!c.selected}"/> </apex:column> <apex:column value="{!c.acct.subject}"/> <apex:column value="{!c.acct.Id}"/> <apex:column value="{!c.acct.owner.name}"/> <apex:column value="{!c.acct.Billable_Hrs__c}"/> <apex:column value="{!c.acct.Rate_Hrs__c}"/> <apex:column value="{!c.acct.Billable_Amount__c}"/> </apex:pageblockTable>
<apex:commandbutton value="send mail" action="{!send}"/>

</apex:form>
</apex:page>





conroller:

public class sendEmail { 
 

    public PageReference send() {
        // Define the email  
    
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 

  

        // Take the PDF content
 
  PageReference pdf = page.sendemail;
  pdf.getParameters().get('results');
  Blob b = pdf.getContent();
  

        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName('attachment.pdf');
        efa.setBody(b);


  

        // Sets the paramaters of the email  
    
        email.setSubject( subject );
        email.setToAddresses(new string[] {'mahe2682@gmail.com'});
 
        email.setPlainTextBody( body );

        email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});

        // Sends the email  
    
        Messaging.SendEmailResult [] r = 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
        
        return null;
    }
}



 

 

 

 

actually It will generate pdf  file but i could not open the file.

 

give me solution for how to resove it.

 

Thanks,

Mahendiran.