• bprakash
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 43
    Replies

How can i get the difference of two sets?

Set<Id> A,Set<Id>B

 

i need to find difference between A & B

 

PLease suggest on this

 

Thanks

Hi 

Iam trying to find number of assets on account with some coditions

i had used aggregate funtion,its not giving the correct results.Please i need help on this,waiting for the reply

  AggregateResult[] groupedResults1 =([SELECT AccountId,COUNT(ID)ct FROM Asset where accountid in:contId AND Status != 'Returned' AND Type__c !='Converted'  group by AccountID,Status,Type__c]);

MPS 00:E0:81:C2:DA:55 [days] [r]

 

this is the string i want the first space length so that i can use in my apex code.This all iam doing in a class,i had find a function on fromula fields but it has no use in apex.

can any tell me how to find first space in a string(means position of space in string)

Thanks

Bhanu

String query = 'select Id,Name,OwnerId,Key__c from ContractLineItem where Key__c LIKE ERROR%';
 I had use the above mentioned query in batch which throws an error says as viable error how can i use LIKE in this case i need the contractLineitem keys which contains error in key.
Any help is greatly appreciated

I have an account and it has 10 assets,i have a formula field number called support,in apex i want to sort it out so that i can get the max number value on support.

It says that formula fields are decimal so i had given list type as decimal and i sorted that,what i found in the debug log is 0,0,0,0...

I had cleared that one in the loop,Please help me out...

Thanks

Bhanu

Hi,iam using quote sync package to syn the quotes.

while syncing one quote line item it throws the error,

Attempted to sync object 00kQ0000008NH23 which was previously synced in this transaction 

 

i had checked the product pricebook,pricebook entry everything looks fine.

ANy one has any suggestion.


can anyone please tell how the test class for pricebook is defined?

i am some kind of trouble with the test code

 Pricebook2 standardPB = [select name, isactive from Pricebook2 where IsStandard = true limit 1];
          


         // Pricebook2 standardPB = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true,isStandard=true);  (SHOWING ERROR HERE error here no lists found)


         // insert standardPB;
        Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true);
        insert pb;
        Product2 prod = new Product2(Name = 'Anti-infectives 2007', Family = 'Best Practices', IsActive = true);
        insert prod;

        PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = standardPB.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
        insert standardPrice;

        PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
        insert pbe;

 

 

Can someone please expalin me how to overcome this.

Please tell me how to make this working?

I had an issue with the button,I had a user whose profile is partner,if the profile is partner then i need to "enable as partner portal"on the contact associated with that user.\

Here Enable as partner portal is standard button of salesforce.

How can i achieve this?

Thanks

Praka

can i control the render  in component which iam using in visualforce email template?

In visual force email templates,Can we make the <span > tag invisible if the table below the tag is empty means no values are there in the table?

iam using the datatable  in visualforce email template,and the title given for this datatable by using <span> tag 'My Test' .My Test is the title for datatable.

 

Is this the way i need to do,or there is another way/

 

My requirement is whenever there are no values are in datatable i need to make the title invisible,this needs to be done in visualforce email template

 

Thanks

Kan

hi,

I had something wrong with the batch apex,

global class AssetUpdateContract1 implements Database.Batchable<sObject> {
    
    String query = 'select Id, AssetId, Key__c, Status, StartDate, EndDate, CreatedDate, PricebookEntry.Product2.Type__c, PricebookEntry.Product2.Level__c,PricebookEntry.Product2.Sharing_Content_Option__c,PricebookEntry.Product2.License_Feature__r.Name from ContractLineItem';
    Public Boolean runTestMethod = false;
   
    global  AssetUpdateContract1() {
     }

    global  AssetUpdateContract1(String q) {
       query = q;
     }
    
    global database.queryLocator start(Database.BatchableContext BC) {
         
        if(runTestMethod) {
            query = query + ' LIMIT 200';
        }
        return database.getQueryLocator(query);

    } //Close start Method
  
     global void execute(Database.BatchableContext BC, list<ContractLineItem> ConList) {
     
           Set<Id> assetIdSet = new Set<Id>();
           Set<Id> assetIdSet1 = new Set<Id>();
       
           Set<Id> assetIdSet2 = new Set<Id>();
           Set<Id> assetIdSet3 = new Set<Id>();
         Map<Id, List<ContractLineItem>> assetCLIList = new Map<Id, List<ContractLineItem>>();

          Map<Id, List<ContractLineItem>> assetCLIList1 = new Map<Id, List<ContractLineItem>>();
           Map<Id, List<ContractLineItem>> assetCLIList2 = new Map<Id, List<ContractLineItem>>();

            Map<Id, List<ContractLineItem>> assetCLIList3 = new Map<Id, List<ContractLineItem>>();
             
         for(ContractLineItem Con : ConList){
               
             if(Con.AssetId != null && (Con.Status  =='Active' ||Con.Status  =='Inactive') && Con.PricebookEntry.Product2.License_Feature__c != null && Con.PricebookEntry.Product2.License_Feature__r.Name == 'FireEye Support') {

                     if(assetCLIList.get(Con.AssetId) != null) {
                        List<ContractLineItem> tempCLIList = (List<ContractLineItem>)assetCLIList.get(Con.AssetId);
                        tempCLIList.add(Con);

                                    } 
                                    else {
                        List<ContractLineItem> tempCLIList = new List<ContractLineItem>();
                        tempCLIList.add(Con);

                        assetCLIList.put(Con.AssetId, tempCLIList);
                         }                 
                   assetIdSet.add(Con.AssetId);
                     }
                     

HI,

How to set the callback url for the remote access?

can anyone give the specific directions for rest api integration?

Thanks

 

i did the cloning but its picking the products on the opportunities,i just need to pick the quote line items of the particular quote after the clone.

What is the best way to do this?

If we have 3 items on a list  and each has a checkbox

if we select one item for one time and that item should not be shown next time when we are trying to select.

Is there Any way to do this?

I used the selection option class in controller class

Thanks

Bahnu



How can i get the difference of two sets?

Set<Id> A,Set<Id>B

 

i need to find difference between A & B

 

PLease suggest on this

 

Thanks

Hi 

Iam trying to find number of assets on account with some coditions

i had used aggregate funtion,its not giving the correct results.Please i need help on this,waiting for the reply

  AggregateResult[] groupedResults1 =([SELECT AccountId,COUNT(ID)ct FROM Asset where accountid in:contId AND Status != 'Returned' AND Type__c !='Converted'  group by AccountID,Status,Type__c]);

MPS 00:E0:81:C2:DA:55 [days] [r]

 

this is the string i want the first space length so that i can use in my apex code.This all iam doing in a class,i had find a function on fromula fields but it has no use in apex.

can any tell me how to find first space in a string(means position of space in string)

Thanks

Bhanu

I have an account and it has 10 assets,i have a formula field number called support,in apex i want to sort it out so that i can get the max number value on support.

It says that formula fields are decimal so i had given list type as decimal and i sorted that,what i found in the debug log is 0,0,0,0...

I had cleared that one in the loop,Please help me out...

Thanks

Bhanu

can anyone please tell how the test class for pricebook is defined?

i am some kind of trouble with the test code

 Pricebook2 standardPB = [select name, isactive from Pricebook2 where IsStandard = true limit 1];
          


         // Pricebook2 standardPB = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true,isStandard=true);  (SHOWING ERROR HERE error here no lists found)


         // insert standardPB;
        Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true);
        insert pb;
        Product2 prod = new Product2(Name = 'Anti-infectives 2007', Family = 'Best Practices', IsActive = true);
        insert prod;

        PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = standardPB.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
        insert standardPrice;

        PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
        insert pbe;

 

 

Can someone please expalin me how to overcome this.

Please tell me how to make this working?

I'm writing a unit test on the opportunity and opportunity line item.  I am getting the error "No standard price is defined".

 

Here is my test method:

 

public static testMethod void test3() 
    { 
    	Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true);
    	insert pb;
    	Product2 prod = new Product2(Name = 'Anti-infectives 2007', Family = 'Best Practices', Practice__c = 'GP/BP', Service_Level__c = 'Partial Service', Product_Abbrev__c = 'CMR_Antiinfect', Sales_Unit__c = 'Each', Standard_Unit__c = 'Each', Product_Year__c = '07', Item_Type__c = 'Non-Inventory (Sales only)', IsActive = true);
    	insert prod;
    	PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
    	insert pbe;
    	Opportunity opp = new Opportunity(Name = 'Test Syndicated 2010', Type = 'Syndicated - New', StageName = 'Planning', CloseDate = system.today());
    	insert opp;
    	OpportunityLineItem oli = new OpportunityLineItem(opportunityId = opp.Id, pricebookentryId = pbe.Id, Quantity = 1, UnitPrice = 7500, Description = '2007 CMR #4 - Anti-Infectives');
    	insert oli;
		List<OpportunityLineItem> olis = [Select Id From OpportunityLineItem Where OpportunityId =: opp.Id];
		update olis[0];
    }

 

The error is thrown on the line where I try and insert the PricebookEntry record:

 

PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false);
    	insert pbe;

 

I'm not sure what I'm missing. 

 

Thanks for any help.

Regards.

 

I have a query

public Pricebook2 getPricebook2()
{
Opportunity opp_info = getOpportunity();
Pricebook2 pricebook_info = [select Id, P.Name, P.IsActive, P.Description from Pricebook2 P
where P.id = : opp_info.Pricebook2Id];
return pricebook_info;

 

How would I test this in my test class?

 

This is what I have in my test class

 

Pricebook2 pb_info = new Pricebook2 (name='testbook',description='asdsdfsf', IsActive=true);
insert pb_info;
controller.getPricebook2();

 where controller is an object of the visualforce controller I'm trying to test.

 

But I get an error message that says

 

 

Class.myOpportunityController.getPricebook2: line 40, column 37 Class.myOpportunityTestClass.myControllerTest: line 67, column 10 System.QueryException: List has no rows for assignment to SObject

 

 

 

 

 

 

Message Edited by teknicsand on 04-02-2009 04:03 AM
I want to convert DateTime Value to Date Value , Please help me out ????????????