• Darshan Farswan
  • NEWBIE
  • 130 Points
  • Member since 2011

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 55
    Replies
Hello,

I have reached max tab limit,
Is it possible to packag my application in Dev environment and package it to production ?

In that case i may save the tabs..

If this is possible, what will be drawbacks
  • September 07, 2015
  • Like
  • 0
how to navigate from one custom STANDARD VF PAGE to another custom CONTROLLER VF PAGE. please tell me as early as possible.




Thanka&Regards
Ranga
Hi All,

I have a problem in converting the body of pdf file to a string. 

I tried something like this
Say for example the pdf file is stored in static resource :

My code looks like:
blob b = [select body from staticResource where name = 'testDoc'].body;
string s = b.tostring(); // here i am getting an error like "blob is not a valid UTF-8" 

I found what is the casue but I am not able to overcome that.
The issue is that the body of pdf will have some special character like " ê , ç , ã ".

So that it is showing such error I think. Can anyone help me out !!

Thanks in advance.
  • February 01, 2015
  • Like
  • 0

I created a custom VF page called Renters, that is used to capture information similar to Contacts. When a user clicks on the "Save" button I want the record to save and then automatically create a new Opportunity with some of the information captured in the VF page. I can get the record to save but how do I also get it to create a new Opportunity?

 

I'm not sure where to start.

  • September 13, 2011
  • Like
  • 0

I made a trigger to delete the Opportunity Sales Team Members whenever the User is made inactive. The trigger is working perfectly as expected. The user i fetched in the test class is an active user. And then i added the user to an opportunity sales team. In the test class when i set the active status of the User to false and update the user object, the values for isActive is still true in the trigger. The tigger is an after Update trigger on User.

Hello,

I have reached max tab limit,
Is it possible to packag my application in Dev environment and package it to production ?

In that case i may save the tabs..

If this is possible, what will be drawbacks
  • September 07, 2015
  • Like
  • 0
how to navigate from one custom STANDARD VF PAGE to another custom CONTROLLER VF PAGE. please tell me as early as possible.




Thanka&Regards
Ranga
Hello All,
Is it possible to generate a PDF document from an apex web service?
My requirement is as follows:
The user wants to download a PDF document in the front end portal (front end being built by a third party). On click of the button, a Web service will be invoked to fetch the data from Salesforce. The response of the web service is a JSON response. The front end does not use a VF page to use renderAs() function.

Is there any way in which I can send this response as a PDF for the portal user to view it as a PDF when he clicks on the buton. The PDF needs to be generated dynamically every time this button is clicked and I do not want to store the PDF data in the attachement object as this may lead to creation of 'n' number of files for a single functionality.
 
Hi All,

I have a problem in converting the body of pdf file to a string. 

I tried something like this
Say for example the pdf file is stored in static resource :

My code looks like:
blob b = [select body from staticResource where name = 'testDoc'].body;
string s = b.tostring(); // here i am getting an error like "blob is not a valid UTF-8" 

I found what is the casue but I am not able to overcome that.
The issue is that the body of pdf will have some special character like " ê , ç , ã ".

So that it is showing such error I think. Can anyone help me out !!

Thanks in advance.
  • February 01, 2015
  • Like
  • 0
Hi,

  I have requirement that,when a user creates a record the external user will get an email with the record URL(i.e.with record ID) along with an autogenrated password.So once the external user clicks on the link in his emial it navigate to a login page to enter the autogenerated password which he has got through email to access that responding record.

Please help me how to achieve this functionality.
public class AddmultipleAccountsController
{
Account account = new Account();
public list<Account> listAccount{ get; set; }
public AddmultipleAccountsController()
{
listAccount=new list<Account>();
listAccount.add(account);
}
Public void addAccount()
{
Account acc = new Account();
listAccount.add(acc);
}
public PageReference saveAccount()
{
for(Integer i=0; i<listAccount.size(); i++)
{
insert listAccount;
}
return Page.Allaccountssaved;
}
}
I want to change ownership of any record to the another user so if i am trying to change "owner.id" it gives error not writable .
Hi,

I am quering the custom objects records based on ownerid and logindate field. Now i want to query the record based on order by ownerid and order by loginate field.

My requirement is i want to get the records for every user  in ASC order of records for every user.


Can any one help me....


Thanks,
Sarvesh.
Hi,

    how we will call a workflow by using apex class?
I have a competitor object. It has lookup and Master-detail relationship to Account Object. When i try to mass insert records, I get the follwing error
"autoinsertforcompetitor: execution of BeforeInsert caused by: System.ListException: Before Insert or Upsert list must not have two identically equal elements Trigger.autoinsertforcompetitor: line 48, column 1"

Here's my code

trigger autoinsertforcompetitor on Competing_Customer__c (before insert,after delete)
{
         list<Competing_Customer__c> newcompetitor=new list<Competing_Customer__c>();
     list<Competing_Customer__c> competitorlist=new list<Competing_Customer__c>();
     Competing_Customer__c competitor = new Competing_Customer__c();
   
    if (!TriggerHelperClass.hasAlreadyfired())
    {system.debug('in inset'+TriggerHelperClass.hasAlreadyfired());
        if(trigger.isInsert)
    {  
    for(Competing_Customer__c obj:trigger.new)
        {
          
        Competing_Customer__c[] comp=[select Account__c,Account_competitor__c from Competing_Customer__c where Account__c = :obj.account__c AND Account_competitor__c = :obj.Account_competitor__c];
      if (comp.size() > 0 )
      {
          system.Debug('in if');     
          obj.adderror('this is a duplicate entry');
      }
            else{
       system.debug('step');
                system.debug('in else');
           newcompetitor.add(obj);
            }
        }
   
    for(integer i=0;i<newcompetitor.size();i++)
        {

        competitor.Account__c=newcompetitor[i].Account_competitor__c;
        competitor.Account_competitor__c=newcompetitor[i].account__c;
        TriggerHelperClass.setAlreadyfired();
     
            competitorlist.add(competitor);
        }
  insert competitorlist;
       
    }
   
    }
    if(trigger.isDelete)
    {
        system.debug(TriggerHelperClass.hasAlreadyfired());
        if (!TriggerHelperClass.hasAlreadyfired())
            {
    for(Competing_Customer__c obj:trigger.old)
        {
            newcompetitor.add(obj);
        }
           
                try{
                for(integer i=0;i<newcompetitor.size();i++)
        {
        competitor=[select id from Competing_Customer__c where Account__c = :newcompetitor[i].Account_competitor__c AND Account_competitor__c = :newcompetitor[i].Account__c];
                competitorlist.add(competitor);
                TriggerHelperClass.setAlreadyfired();
            }
       
               
                delete competitorlist;}
                catch(exception e)
                {system.debug('catch error');}
    }
       
}
}

Hi all,

 

In Standara page there one picklist, based on the selecting picklist values we need to be display checkbox ? It should be happen in standard page ? is the possible ?

if not please provide any other suggestion ?

 

 

Thanks,

I am writing test class for below code:

 

Global class OpportunityController{
public OpportunityController(ApexPages.StandardController controller) {
oppList = New List<Opportunity>();
op = (Opportunity )controller.getRecord();
System.debug('op----'+op);
System.debug('opPayment_Terms__c ----'+op.Payment_Terms__c );
System.debug('opId----'+op.Id);
oppList = [SELECT Name,Payment_Terms__c,Account.BillingCountry,(SELECT Margin__c FROM OpportunityLineItems) FROM Opportunity WHERE Id =: op.Id];
System.debug('oppList ----------'+oppList );
System.debug('oppListPayment_Terms__c ----------'+oppList[0].Payment_Terms__c );
}

 

 

Test class code :

 

static testMethod void OpportunityController2() {
Account acc = new Account(Name='Testing1',BillingCountry='USA');
insert acc;

System.debug('::::::acc::::::::::'+acc); 
Opportunity opp = new Opportunity(Name='Test Opp4',AccountId=acc.Id,
Payment_Terms__c = 'testing 60',CloseDate=System.today().addMonths(1),StageName='Negotiations');
insert opp;

System.debug('::::::opp::::::::::'+opp); 
System.debug('::::::opp.Payment_Terms__c:::::::::::'+opp.Payment_Terms__c);
OpportunityController controller1 = new OpportunityController(new ApexPages.StandardController(opp));

}

 

In that Test code I have inserted one Opportunity with Payment_Terms__c field value.I am running the test method I got the following output:

 

:::::::acc::::::::::Account:{Name=Testing1, BillingCountry=South Africa, Id=001S000000cqIbiIAE}:
:::::opp:::::::::::Opportunity:{Name=Test Opp4, StageName=Negotiations, Payment_Terms__c=testing 60 days, AccountId=001S000000cqIbiIAE, Id=006S0000006dj9hIAA, CloseDate=2013-04-15 00:00:00}
::::::opp.Payment_Terms__c:::::::::::testing 60 days

 

Original class output:

 

oppList ----------(Opportunity:{Name=Test Opp4, AccountId=001S000000cqIbiIAE, Total_List_Price__c=0.00, Is_Step2_Required__c=false, Id=006S0000006dj9hIAA, Total_Discount__c=0.00})
opportunity.Payment_Terms__c ----------null

 

In original class code Payment_Terms__c field always shows null value.But I have inserted Payment_Terms__c value in Test class.I noticed in debug log  i.e  Payment_Terms__c field values didn't add in the oppList.Is any one help to get the Payment_Terms__c value in Original class?

Hi 

   Below is my code which is working properly in Dev org but not in Production. From production am geeting exception.

 

caused by: System.QueryException: List has no rows for assignment to SObject

 

Class.JobSuite.RetrieveTaskNewTesting.<init>: line 731, column 1

 

 

public List<Job_Task__c> lstJT{get;set;}

//Constructor

public RetrieveTaskNewTesting(ApexPages.StandardController st)
{
TaskId3=ApexPages.CurrentPage().getParameters().get('paramU');
jobId = ApexPages.currentPage().getParameters().get('id');
Job__c objJob=[Select Id,Campaign__c from Job__c where Id=: jobId LIMIT 1];
campaignId=objJob.Campaign__c;
lstJT=[Select Name, Start_Date__c,Days__c,Due_Date__c,Task_Order__c,Assigned_Users__c,Marked_Done__c,Completion_Date__c,Revised_Due_Date__c from Job_Task__c where Job__c =: jobId Order By Task_Order__c];
lstJobTeam=[Select Id, Role__c,Staff__c, Job__r.Name from Job_Team__c where Job__c =: jobId order by createddate];

 

 

  Thanks in advance

 

 

..Shashi