• cvm_asish
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies

hello friends,

 

I need a help in checking the status of each batch apex!

 

Scenario:

 

01. I have a "for" loop, which will get a list of records(each records contains query).

02. Loop through each record and execute the batchapex.

 

Issue:

 

Consider there are 15 different queries. I think only 5 batch apex can execute at a time (status = Processing or Queued). So in the "for" loop I want to execute the next batch apex only if the previous one is completed.

 

Question:- How we can achieve the above scenario?

 

Current Soln:- I tried with a "While" loop. Inside the "for" loop once the batchapex is executed I'll call a While loop to check the status of that "batch" with the batchID. This While loop will go until I'll get the status "Completed". But the problem here is, if the batch takes more time then the number of SOQL call to check the status in While loop will exceed the "limit".

 

Please help me out!

 

Thanks in advance!

 

Thanks

Asish

Hello friends,

 

I am facing an issue, While login to the site I am using "return Site.login(username, password, startUrl);",

 

In startURL I need to pass the account ID also.

 

Issue:- I'll not be able to hit the User object and get the AccountID before logged in.

 

Could you please some one tell me whether any other workaround for this?

 

Thanks in advance.

 

Thanks

Asish

hello friends,

 

I have created a "Site" in Force.com. Initially I was getting "ChangePassword" page for first time login users (new user), but now its not going through "ChangePassword" for "new users" .

 

Can u pls tell any suggestions / solutions? Do I need to particularly set any permission?

 

Thanks in advance!!

 

Thanks

Asish

hello friends,

 

I am facing an issue with Map<>.

 

Step1:- I have created a Map<> with list of products (which is getting from one object, say "Product").

 

Step2:- I am getting records which has product ID from another object (say "Purchase").

 

Step3:- I am looping through each record from Purchase and get the "ProductId"  and reference to the Map<> I have created from the "Product" object.

 

Issue :- If the ProductId is not there in the map<> it will through an error "System.NullPointerException: Attempt to de-reference a null object".

 

How can I avoid the ID's which are not in the Map<>? How can I identify that the ID is not in the Map before I make a refernce to the Map<>?

 

Thanks in advance.

 

Thanks

Asish

hello friends,

 

I have a doubt in "generic sObject Type" declaration. I was going through one PDF and I got the below example, but I didn't understand exactly what does it means.

 

Can someone clearly explain this with some simple example?Why for the contact its showing error? In which scenario this type of declaration required?

 

 

-------------------------------------------------------------------------------------------------------------------------------

Similar to the Web Services API, Apex allows the use of the generic sObject abstract type to represent any object. The sObject data type can be used in code that processes different types of sObjects.

The new operator still requires a concrete sObject type, so all instances are specific sObjects. For example:

sObject s = new Account();

You can also use casting between the generic sObject type and the specific sObject type. For example:

// Cast the generic variable s from the example above 
    
// into a specific account and account variable a 
    
Account a = (Account)s;
// The following generates a runtime error 
    
Contact c = (Contact)s;

DML operations work on variables declared as the generic sObject data type as well as with regular sObjects.

 

-------------------------------------------------------------------------------------------------------------------------------

 

 

Thanks in advance.

 

Thanks

Asish

Message Edited by cvm_asish on 01-17-2010 11:36 PM

hello friends,

 

I have created two objects. One for "Supplier" and another for "Customer". Both object have a lookup relation with native "Contact" object. I have overridden the "New" button in Contact object with a visualforce Page. Now the issue is:-

 

How do I know that from which Object's related list(Contact) I have clicked to create a new Contact? Is it coming from "Supplier" or from "Customer".

 

It will be greatful if you can give some quick response.

 

Thanks in advance.

 

Thanks

Asish  

 

Hello friends,

 

I am not able to edit the native object "Account" when logged in as a Partner Portal user. I have created a different Profile for these users and given all the permissions to "Account" object for the same profile. I am using the native "Edit" button only. When I logged in to the site I can able to see all my values in Account object. But when I click on "Edit" button it will show a message "Insuffient Privilege" .

 

Could you pls help me to figure out the issue? I tried with so many scenarios but didnt work for me. I am new to this salesforce.

 

Thanks in advance

Asish

 

hello friends,

 

I need a help in checking the status of each batch apex!

 

Scenario:

 

01. I have a "for" loop, which will get a list of records(each records contains query).

02. Loop through each record and execute the batchapex.

 

Issue:

 

Consider there are 15 different queries. I think only 5 batch apex can execute at a time (status = Processing or Queued). So in the "for" loop I want to execute the next batch apex only if the previous one is completed.

 

Question:- How we can achieve the above scenario?

 

Current Soln:- I tried with a "While" loop. Inside the "for" loop once the batchapex is executed I'll call a While loop to check the status of that "batch" with the batchID. This While loop will go until I'll get the status "Completed". But the problem here is, if the batch takes more time then the number of SOQL call to check the status in While loop will exceed the "limit".

 

Please help me out!

 

Thanks in advance!

 

Thanks

Asish

Hello friends,

 

I am facing an issue, While login to the site I am using "return Site.login(username, password, startUrl);",

 

In startURL I need to pass the account ID also.

 

Issue:- I'll not be able to hit the User object and get the AccountID before logged in.

 

Could you please some one tell me whether any other workaround for this?

 

Thanks in advance.

 

Thanks

Asish

hello friends,

 

I have created a "Site" in Force.com. Initially I was getting "ChangePassword" page for first time login users (new user), but now its not going through "ChangePassword" for "new users" .

 

Can u pls tell any suggestions / solutions? Do I need to particularly set any permission?

 

Thanks in advance!!

 

Thanks

Asish

hello friends,

 

I am facing an issue with Map<>.

 

Step1:- I have created a Map<> with list of products (which is getting from one object, say "Product").

 

Step2:- I am getting records which has product ID from another object (say "Purchase").

 

Step3:- I am looping through each record from Purchase and get the "ProductId"  and reference to the Map<> I have created from the "Product" object.

 

Issue :- If the ProductId is not there in the map<> it will through an error "System.NullPointerException: Attempt to de-reference a null object".

 

How can I avoid the ID's which are not in the Map<>? How can I identify that the ID is not in the Map before I make a refernce to the Map<>?

 

Thanks in advance.

 

Thanks

Asish

hello friends,

 

I have a doubt in "generic sObject Type" declaration. I was going through one PDF and I got the below example, but I didn't understand exactly what does it means.

 

Can someone clearly explain this with some simple example?Why for the contact its showing error? In which scenario this type of declaration required?

 

 

-------------------------------------------------------------------------------------------------------------------------------

Similar to the Web Services API, Apex allows the use of the generic sObject abstract type to represent any object. The sObject data type can be used in code that processes different types of sObjects.

The new operator still requires a concrete sObject type, so all instances are specific sObjects. For example:

sObject s = new Account();

You can also use casting between the generic sObject type and the specific sObject type. For example:

// Cast the generic variable s from the example above 
    
// into a specific account and account variable a 
    
Account a = (Account)s;
// The following generates a runtime error 
    
Contact c = (Contact)s;

DML operations work on variables declared as the generic sObject data type as well as with regular sObjects.

 

-------------------------------------------------------------------------------------------------------------------------------

 

 

Thanks in advance.

 

Thanks

Asish

Message Edited by cvm_asish on 01-17-2010 11:36 PM

hello friends,

 

I have created two objects. One for "Supplier" and another for "Customer". Both object have a lookup relation with native "Contact" object. I have overridden the "New" button in Contact object with a visualforce Page. Now the issue is:-

 

How do I know that from which Object's related list(Contact) I have clicked to create a new Contact? Is it coming from "Supplier" or from "Customer".

 

It will be greatful if you can give some quick response.

 

Thanks in advance.

 

Thanks

Asish  

 

Hello friends,

 

I am not able to edit the native object "Account" when logged in as a Partner Portal user. I have created a different Profile for these users and given all the permissions to "Account" object for the same profile. I am using the native "Edit" button only. When I logged in to the site I can able to see all my values in Account object. But when I click on "Edit" button it will show a message "Insuffient Privilege" .

 

Could you pls help me to figure out the issue? I tried with so many scenarios but didnt work for me. I am new to this salesforce.

 

Thanks in advance

Asish

 

I can't seem to debug this problem because it's on Force.com sites and I just get redirected to a page saying, Error: Error occurred while loading a Visualforce page.

 

I don't any emails telling me what the problem is, so I have to go through and find it myself and went through line by line to find the problem. It seems the problem is using DML to execute and update query on multiple rows.

 

Any clue?

 

 

// if user is logged in:
tbi = [SELECT Id, Name, GuestIP__c, User__c, Event__c FROM Basket__c WHERE User__c=:UserInfo.getUserId()];

// ...
// URL always has gid parameter (guest id)

gbi = [SELECT Id, Name, GuestIP__c, User__c, Event__c FROM Basket__c WHERE GuestIP__c=:AppGlobal.getParam('gid')];

List<Basket__c> deleteRec = new List<Basket__c>();
List<Basket__c> updateRec = new List<Basket__c>();

for ( i=0; i<gbi.size(); i++ )
{
deleted = false;

for ( x=0; x<tbi.size(); x++ )
{
if ( tbi[x].Event__c == gbi[i].Event__c )
{
deleteRec.add(gbi[i]);
deleted = true;
break;
}
}

if ( !deleted )
{
gbi[i].User__c = UserInfo.getUserId();
gbi[i].GuestIP__c = '';
updateRec.add(gbi[i]); // fails here (but not when testing!!!)

}
}

if ( updateRec.size() > 0 ) update updateRec; // fails here (but not when testing!!!)
if ( deleteRec.size() > 0 ) delete deleteRec;

 

Thanks in advance if you can find the problem!

 

 

Message Edited by admintrmp on 10-05-2009 08:22 AM