function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mnoorgatmnoorgat 

Best way to get data - perfect view is in a (case) page layout

Hi,

I'm new to salesforce development.  I'm currently using C# .NET (through VS 2003) and Web services API version 5.0 and Enterprise WSDL.  I have been experimenting with the quickstart example to help me get to grips with the api.

What I would like to do is get all cases which were created with a specific page layout (I can get this via the record type), and then filter down these results further depending on the value of a custom field specified in that page layout.

The first part I can do using for example a query which looks a bit like this:

qr = binding.query("select CaseNumber, Company_Name__c, Project_Type__c from Case where RecordTypeID='0122000000001HqAAI'");

1) Can I do this easily by using the RecordType.Name (so I don't have to manually find the ID first)?

2) How do I do the second part (filtering down) as described above?

Any help / pointers would be greatly appreciated.

Thank you.

DevAngelDevAngel

Hi mi5tery,

You cannot use the RecordType name in the query.  You can use it to get the id, but you still need to use the id in the query.

 

The second part of the question then, is make your criteria " where recordtypeid = 'someid' and mycustomfield__c = 'cool'".  

Eess good?

mnoorgatmnoorgat

Thanks Dave,

1) Getting the ID shouldn't be a problem, it's nice to know what I can and can't do, thanks =)

2) In regards to the second question: What you suggested is precisely what I want to do... except I don't see my custom field in the WSDL definition of available fields for Case?

I have a "Picklist (Multi-Select)" field described as "Available_to_Class" (field name).  I'd expect this to be referred to as Available_to_Class__c.  When I do the query it seems to find what I'm looking for fine - for one value (btw, my multi-picklist has values 2003,2004,2005 etc - any ideas on what I should specify for example to find records where the picklist may have values 2003 or 2004?).

The problem I face is I don't know how to refer to the Available_to_Class__c field to get the value "out" so to speak.  Currently I am doing something along the lines of (in a loop):

sforce.Case cas = (sforce.Case)qr.records[i];
string caseNum = cas.CaseNumber;

I can't do: string availToClass = cas.Available_to_Class__c; as it throws an error on compilation.

Any guidance, as always is greatly appreciated.  Thank you in advance.

SuperfellSuperfell
You need to re download your enterprise WSDL from the application.
mnoorgatmnoorgat

Thanks Simon,

SIlly me, I did re-download the enterprise WDSL but I forgot to "Update web references"!  It works as expected - I won't be making that mistake again in a hurry - I hope! =)

I have a "Picklist (Multi-Select)" field described as "Available_to_Class" (field name).  When I do the query it seems to find what I'm looking for fine - for one value (possible values 2003, 2004, 2005, 2006), any ideas on what I should specify for example to find all records where the picklist may have values 2003 or 2005?

Any ideas on what I should type in my query after the where part to return all rows where Available_to_Class__c = '2003' or '2005' (for example)?

Thank you for your time and assistance. =)

SuperfellSuperfell
look at the includes operator, its something like

Available_to_Class__c includes "2003" or Available_to_Class__c includes "2005"
mnoorgatmnoorgat

Thanks again Simon,

The exact Syntax was:

where Available_to_Class__c includes ('2003', '2005')

Once I had the keyword the rest was easy - thank you. =)