Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Counting Records in a Portal that meet certain conditions


Bobg
 Share

Recommended Posts

I am trying to place a number on a screen that represents the number of line items in the portal that have sold. I've created a new field called TotalCountofSales. It's a calculated field that is trying to determine how many Line Items have sold. To determine this I have to check all SoldDates fields in the portal and count the ones that have been populated with SoldDates. I see that functions like Count are not allowed in the calculation. What is the easiest way to accomplish this?

 

Thanks for your help

Bob Green

Link to comment
Share on other sites

1) Regarding your portal scripting issue from last week:

 

Make sure the Script Trigger is set to fire on "OnObjectModify" in your script.

 

2) In the portal table create the following fields:

 

ITEM SOLD (calculated field) = If (Not (IsEmpty(DateSold));1;"")

 

ITEMS SOLD TOTAL (summary field) ---> based upon ITEM SOLD

 

Place the summary field under your portal to get number of items sold.

 

3) While you are doing that you might as well get a total of the number of records in the portal

 

LINE ITEM (calculated field) = 1

 

LINE ITEMS TOTAL (summary field) ---> based upon LINE ITEM

 

 

 

I think these will work for you!

 

 

**Edit: A huge thank you to Al Hunter, which is where I learned the simple method of counting portal records!

Link to comment
Share on other sites

John,

 

Your Number 2 and Number 3 points worked great.(Both very clever!)

The problem with your point number 1 is that OnObjectModify does not work since the script is attached to a date field.

As soon as I type in a number for the month the script triggers and informs me that the date I entered is not in the correct

format. I could put in a drop down date but that would not allow my user to type in a date, as well as, click on one. I would prefer

they could enter either way I've also tried OnObjectSave and OnObjectExit.

 

Did you get the email I sent with my file enclosed? That should let you see the script and test it.

 

Thanks for help on points 2 and 3!

 

Bob

Link to comment
Share on other sites

The problem with your point number 1 is that OnObjectModify does not work since the script is attached to a date field.

As soon as I type in a number for the month the script triggers and informs me that the date I entered is not in the correct

format. I could put in a drop down date but that would not allow my user to type in a date, as well as, click on one. I would prefer

they could enter either way I've also tried OnObjectSave and OnObjectExit.

Bob

 

1) It worked with a drop down date.

 

2) If you want your end user to type in a date then use "OnObjectSave" but add "Commit Record/Request" in the script just before the "Go to Field" step. The commit step will in effect save the record which should fire the script. With testing a sample, the commit step added and assigning the script to "OnObjectSave," worked as you want it to work.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use