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

Scripted finds- odd results


skingjack
 Share

Recommended Posts

Hello,

 

I was wondering if someone could enlighten me with an issue that is stumping me... I have a scripted find (button) that has as the final step to change the results to reflect a list view. However, for some search criteria but not others, the results remain in form view. The criteria is chosen on a dedicated find layout and the find button (and associated script) never changes. Any thoughts on what might

cause such odd behaviour?

 

May thanks to those that respond.

 

jack

Link to comment
Share on other sites

If you write out your script steps for us you'll get far more useful answers.

 

By "change the results to reflect a list view" do you mean you have the explicit instruction View As

    at the bottom of your Find script?
Link to comment
Share on other sites

You can't attach files as a limited access member; you'll have to type them out. (or print them to PDF and copy to clipboard and paste)

Link to comment
Share on other sites

So I see... here is the script:

 

Go to Layout [ “Find ” (Drivers) ] Set Error Capture [ On ] If [ Get(WindowMode) = 0 ]

Else

#

Enter Find Mode [ ] [ Pause ]

#

End If Perform Find [ ] If [ Get( LastError) = 400 ]

Show Custom Dialog [ Title: "Message"; Message: "No find criteria were entered. All records will be displayed."; Buttons: “OK” ]

Show All Records Else If [ Get(FoundCount)=0 ]

Show Custom Dialog [ Title: "Message"; Message: "No records match this request."; Buttons: “OK” ]

Show All Records Else If [ Get(FoundCount)=1 ]

Go to Layout [ “List View” (Drivers) ] End If

Link to comment
Share on other sites

Redone for the sake of clarity:

 

Go to Layout [ “Find ” (Drivers) ]

Set Error Capture [ On ]

If [ Get(WindowMode) = 0 ]

Else

..Enter Find Mode [ ] [ Pause ]

End If

Perform Find [ ]

If [ Get( LastError) = 400 ]

..Show Custom Dialog [ Title: "Message"; Message: "No find criteria were entered. All records will be displayed."; Buttons: “OK” ]

..Show All Records

Else If [ Get(FoundCount)=0 ]

..Show Custom Dialog [ Title: "Message"; Message: "No records match this request."; Buttons: “OK” ]

..Show All Records

Else If [ Get(FoundCount)=1 ]

Go to Layout [ “List View” (Drivers) ] End If

 

 

 

 

a) Odd and weird things are going to happen if you are in Browse Mode to start with. You have an If statement that doesn't say to do anything if WindowMode is 0 (browse mode). You Perform Find in either case but without restoring requests apparently. I'd expect an error message at that point.

 

b) The script only goes to List View if a Find is successfully performed and results in exactly 1 record. Not 2, not 10, not 0, but 1. Why would you want a List View if there's only one record to look at? Anyway, my guess is that soemtimes you get more than one result in your found set. Multiple records in found set would NOT go to the list view (which is actually a situation where it would be more appropriate). You probably intended if Get (FoundCount) ≥ 1 -- ?

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use