• sunny@99-chg
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 54
    Questions
  • 42
    Replies

Hai,

 

   I have problem with SubQuery,which is Marked Below.

Here I want to Query According to Owner,Which is User Accountid.

I am getting Error.

Can you please help me how to write that Query.

 

user use=[select id,accountid from user where id=:userinfo.getuserid()];
string UserAccount=use.accountid;

public ApexPages.StandardSetController con {
get{
if(con == null) {

con = new ApexPages.StandardSetController(Database.getQueryLocator([select id,o2bc__Sell_Price__c,o2bc__Item_Code__c,name,Qty__c,(SELECT ContentType,attachment.id FROM o2bc__Item__c.attachments WHERE ContentType LIKE '%image%'),(select o2bc__item_serial__c.id,name,owner__c from o2bc__item_serials__r where o2bc__status__c='new'and Owner__c=\'+UserAccount+\') from o2bc__Item__c where o2bc__Type__c IN ('UpgradedPhones') and o2bc__Sell_Price__c!=0 order by o2bc__Sell_Price__c ]));
con.setPageSize(18);
}
return con;
}
set;
}

 

 

Please help me how to Query that value.

Hai All,

 

Please Suggest me for my Task. I need TestCoverage on Apexpages.IdeaStandardSetController.

For my constructor like:

 

public class MyIdeaProfileExtension12 {
private final ApexPages.IdeaStandardSetController ideaSetController;
public MyIdeaProfileExtension12(ApexPages.IdeaStandardSetController controller) {
ideaSetController = (ApexPages.IdeaStandardSetController)controller;

==========================

==========================

==========================
}

public List<Idea> getModifiedIdeas() {

Idea[] ideas = ideaSetController.getIdeaList();
return ideas;
}

 

For my DEV Ideas and related to ideas are Enabled.

Need Urget, For the above Red color constructor.I tried in Many ways.but coudnt find Result

How to call that Constructor Through Constructor..

Hai,

 

In my vfpage I have One Textbox and Two Commandbuttons as button1 ans button2.

 

Afetr entering the Text in Textbox And Click on Button1,My functionality is working Fine.

 

When I enter Text in textbox and press Enter key from Keyboard..The Button2 action is performing,Here I need to work the Button1 Functionality.

 

How to do this,Can Anyone Suggest me...

 

 

Hai,

 

  When i click on Pageblock button,After action status and action completed.The page block buttons are dissappearing.why it is like that,can anyone suggest me for not to dissappear the buttons..

Hai,

 

  Can anyone tell me which Event Is suitable for the inputtext,For the inputtext I wrote auto complete functionality,after selecting the value from auto complete,Whwt event I want to use Can anyone tell me.its Urgent..

Hai ,

 

   I need some help related to write Query as in string format using IN operator.

 

global class autoCompleteController1
{
@RemoteAction
global static SObject[] findSObjects(string obj, string qry, string addFields,string profilename)
{
/* More than one field can be passed in the addFields parameter
Split it into an array for later use */
List<String> fieldList=new List<String>();
if (addFields != '')
fieldList = addFields.split(',');
// list<o2bc__Item__c> oItem=new list<o2bc__Item__c>();
set<id> setId=new set<id>(); // Here i taken the ID's into set,and writing 'IN' operator in Query
for(o2bc__Item__c oitem:[select id from o2bc__Item__c where o2bc__Type__c=:'FreePhones'])
{
setId.add(oitem.id);

}
system.debug('@@@@@@@'+setId);
/* Check whether the object passed is valid */
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.SObjectType sot = gd.get(obj);
if (sot == null)
{
return null;
}

/* Creating the filter text */
String filter = ' like \'' + String.escapeSingleQuotes(qry) + '%\'';


/* Begin building the dynamic soql query */
String soql = 'SELECT Name';

/* If any additional field was passed, adding it to the soql */
if (fieldList.size()>0)
{
for (String s : fieldList)
{
soql += ', ' + s;
}
}

/* Adding the object and filter by name to the soql */
soql += ' from ' + obj + ' where name' + filter;
string pl='new';

if(profilename!='')
{
//profile name and the System Administrator are allowed
soql += ' and Profile.Name like \'%' + String.escapeSingleQuotes(profilename) + '%\'';
system.debug('Profile:'+profilename+' and SOQL:'+soql);
}

soql += ' and o2bc__Item__c IN (\''+setid+'\')' ; // here i used IN operator,I think it is wrong,can any one tell me how to                        

                                                                                write IN operator in query of string format..I want to retrive all the values  w        

                                                                                   with the Id's in the set.now i am not retriving the values.

soql += 'and o2bc__Status__c=\''+Pl+'\' ';

/* Adding the filter for additional fields to the soql */
/* if (fieldList != null)
{
for (String s : fieldList)
{
soql += ' or ' + s + filter;
}
} */

soql += ' order by Name limit 20';

system.debug('Qry: '+soql);

List<sObject> L = new List<sObject>();
try
{
L = Database.query(soql);
}
catch (QueryException e)
{
system.debug('Query Exception:'+e.getMessage());
return null;
}
return L;
}

}

Hai All,

      I have small Doubt,

How to display Error message Under a Custom field(not SObject field) or item in Visualforce through Apex.

Hai,

 

In my vfpage i have 2 pageblock sections

1st section contains two radio buttons

2nd section contains file upload with "Attach" command button to show the attached file.

 

Now i selected one radio button,then i uploaded one file and now when i am click on "Attach" the page refreshes and the selected radio in section 1 dissappears. I need to show the selected radio even after page refresh...

 

Can anyone suggest me how to do this one....

Hai All,

 

I have a problem with Radio Button.

I had Taken 2 HTML Radio buttons in apex page,Now i selected one Radio Button,Now i performed some action on the page and the page will get Refresh,After Refresh The Selected Radio button is not showing as selected.

How to make it as selected Even After Page Refresh....Suggest me...

Hai All,

 

When i was entered the data and saving to Lead,Through VisualForce Page..

It Raising Error...

 

AutomateLeadConversion: execution of AfterUpdate caused by: System.DmlException: ConvertLead failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Converted objects can only be owned by users. If the lead is not owned by a user, you must specify a user for the Owner field.: [] Trigger.AutomateLeadConversion: line 12, column 1

 

My Trigger :

 

trigger AutomateLeadConversion on Lead (After Update) {
system.debug('Enter to convert Lead');
Lead myLead = trigger.new[0];

if( mylead.Incomplete_Application__c == false && myLead.isconverted==false && myLead.SSN_Not_Eligible__c == false && myLead.No_Govt_Proof_Form__c ==false && myLead.No_Program_List__c == false){
//myLead.LeadSource == 'fax'
system.debug('Enter to convert Lead condition');
database.LeadConvert lc = new database.LeadConvert();
lc.setLeadID(myLead.ID);
lc.convertedstatus = 'Closed - Converted';
lc.setDoNotCreateOpportunity(true);
Database.LeadConvertResult lcr = Database.convertLead(lc); ---->Line 12
System.assert(lcr.isSuccess());

}

}

 

 

 Please suggest me What to do for this....

Thanks,

Hai,

 

I am getting Error Please Resolve it...

 

Error: System.DmlException: Update failed. First exception on row 0 with id 00QK0000003I8KhMAK; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadAfterUpdate: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, o2bc.SetOrderLineItemPrice: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object (o2bc): [] Trigger.LeadAfterUpdate: line 64, column 1: [] (System Code) 

 

My Trigger is below:

 

trigger LeadAfterUpdate on Lead (after update)
{
    System.debug('******AfterUpdate********' );
    Set<Id> leadIdsSet = new Set<Id>();
    List<Customer_Certification_Line__c> Progrms = new List<Customer_Certification_Line__c>();
    for(Integer i=0;i<Trigger.old.size();i++)
        leadIdsSet.add(Trigger.old[i].id);
    System.debug('******leadIdsSet*******'+leadIdsSet);    
    System.debug('******Trigger.old[0].IsConverted*******'+Trigger.old[0].IsConverted);
    List<Lead> leadList = [Select id,Credit_Card_Number_Enc__c,mailing_city__c,mailing_address_1__c,mailing_address_2__c,mailing_state__c,mailing_zip_code__c,(SELECT Account__c,Certification_Name__c FROM Customer_Certification_Lines__r),ConvertedAccountId,(Select id,Item__c,Lead__c,Quantity__c from Lead_Line_Items__r) from Lead where IsConverted = true and id in :leadIdsSet];
    System.debug('******leadList*******'+leadList);
    if(leadList.size()>0)
    {
        if (lead.ConvertedAccountId != null) {
            
            for(Lead lead:leadList){
                system.debug(lead.ConvertedAccountId);
                Account a = [Select a.id,a.shippingstreet,a.shippingcountry,a.shippingstate,a.shippingPostalCode,a.shippingcity From Account a Where a.Id = :lead.ConvertedAccountId];
                System.debug('******account fields*******'+a);
                a.shippingcity = lead.mailing_city__c;
                if(lead.mailing_address_2__c!=null)
                    a.ShippingStreet = lead.mailing_address_1__c+' '+lead.mailing_address_2__c;
                else
                    a.ShippingStreet = lead.mailing_address_1__c;
                    a.shippingstate = lead.mailing_state__c;
                    a.ShippingPostalCode = lead.Mailing_Zip_Code__c;
                    a.o2bc__Credit_Card_Number__c = lead.Credit_Card_Number_Enc__c;
                update a;
            }
 
        }
        Map<Id,o2bc__Sales_Order__c> accountIdSalesOrderMap = new Map<Id,o2bc__Sales_Order__c>();
        for(Lead lead:leadList)
        {
            o2bc__Sales_Order__c salesOrder = new o2bc__Sales_Order__c();
            salesOrder.o2bc__Account__c = lead.ConvertedAccountId;
            accountIdSalesOrderMap.put(lead.ConvertedAccountId,salesOrder);
        }
        system.debug('Size is--------->' + accountIdSalesOrderMap.size());
        insert accountIdSalesOrderMap.values();
        System.debug('******accountIdSalesOrderMap*******'+accountIdSalesOrderMap);
        List<o2bc__Order_Line__c> orderLineList = new List<o2bc__Order_Line__c>();
        for(Lead lead:leadList)
        {
            for(Lead_Line_Item__c leadProductLineItem:lead.Lead_Line_Items__r)
            {
                o2bc__Order_Line__c orderLine = new o2bc__Order_Line__c();
                orderLine.o2bc__Item__c = leadProductLineItem.Item__c;
                orderLine.o2bc__Sales_Order__c = accountIdSalesOrderMap.get(lead.ConvertedAccountId).id;
                orderLine.o2bc__Quantity__c = leadProductLineItem.Quantity__c;
                orderLineList.add(orderLine);
            }
            if(lead.Customer_Certification_Lines__r.size()>0){
                
                for(Customer_Certification_Line__c oProgram : lead.Customer_Certification_Lines__r){
                    
                    Customer_Certification_Line__c oProgramList = new Customer_Certification_Line__c(id = oProgram.Id);
                    oProgramList.Account__c = lead.ConvertedAccountId;
                    Progrms.add(oProgramList);
                }
            }
        }
        System.debug('******orderLineList*******'+orderLineList);
        insert orderLineList; // ----->Line 64
        if(!Progrms.isEmpty()){
            update Progrms;
        }
    }
}

Hai All,

 

How to display a visualforce page as popup whenever we click on a standard button,

For Ex: whenever we click on "Convert" Button in a lead,I need to Display a vfpage As popup..

 

Please can anyone suggest me how to do

 

Hi ,
Can any one help to write a test case for the following Apex Classes.
Apex Class:

public class Tva_ExportContactsExtension {
  public Tva_ExportContactsExtension(ApexPages.StandardSetController controller)
   {
     controller.setPageSize(controller.getResultSize());
  }
}