Query.apex icon indicating copy to clipboard operation
Query.apex copied to clipboard

Add more condition methods to SOSL QuerySearch

Open HenryRLee opened this issue 4 years ago • 7 comments

An example of how it is done can be referred to #49.

Basically, the returning clause can be further constrained by more condition methods. These include:

addConditionIn
addConditionNotIn
addConditionLt
addConditionLe
addConditionGt
addConditionGe
addConditionIncludes
addConditionExcludes

Example usage:

new QuerySearch().find('ABC').returning('Account').addConditionLt('CreatedDate', Date.today())

HenryRLee avatar Mar 06 '20 05:03 HenryRLee

I would like to contribute to this. I am new to open source development.

sksonalkothari avatar Mar 07 '20 13:03 sksonalkothari

@sksonalkothari Sure! Give it a go. Feel free to ask us any question.

HenryRLee avatar Mar 07 '20 22:03 HenryRLee

Hi @HenryRLee, I have not done Salesforce apex development before, but it looks similar to JAVA, which is why the code is easy to understand. Please help me with the setup. I have Visual Studio code, I have installed the Salesforce extensions pack. I have looked into many getting started blogs, But still I cannot get how to build, run and debug the code, and also how to test the test cases.

Although I have made the necessary changes in QuerySearch.cls file. Should I write some test cases related to these changes? How to test the same?

sksonalkothari avatar Mar 09 '20 22:03 sksonalkothari

Hi @sksonalkothari. To get started, you'd probably want to have a Salesforce org, which is something like a virtual machine. You may sign up a new org from here (https://developer.salesforce.com/docs/atlas.en-us.externalidentityImplGuide.meta/externalidentityImplGuide/external_identity_create_developer_org.htm).

After that, you need to build the code to your own org. Since you have Visual Studio Code and Salesforce extensions installed, I suppose you can take a look at this tutorial (https://trailhead.salesforce.com/en/content/learn/projects/quickstart-vscode-salesforce/use-vscode-for-salesforce). Focus on the "Authenticate to Your Playground" and "Deploy" sessions.

To run Apex unit tests, this page may be useful (https://salesforce.stackexchange.com/questions/271570/running-unit-test-class-from-vscode). Also, you can run Apex unit tests from developer consoles (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_unit_tests_running.htm).

Sometimes, you don't have to write a unit test code to test your functions, the developer console also allows you to run a piece of Apex code in the Anonymous Window (https://help.salesforce.com/articleView?id=code_dev_console_execute_anonymous.htm&type=5).

HenryRLee avatar Mar 10 '20 03:03 HenryRLee

Hi @HenryRLee , Thanks for the resources. They were really helpful. By implementing the steps given in the above blogs, I was able to signup a new org , I was able to create new project and also authenticate the org. But my only concern was "How to work with git cloned project". After trying few things, I copied all the classes files of git cloned project into my newly created project and then I worked on them. After which, I could deploy the code and also test the project. Please let me know, if I am doing correct.

sksonalkothari avatar Mar 11 '20 16:03 sksonalkothari

Hi @sksonalkothari, git development is very flexible, and the way you are doing is perfectly fine. After you finished, you can copy the class files back to the original path, commit the changes, and create a pull request for code review.

I also found a guide that may be helpful for you, to understand how to commit your changes and submit for the code review: https://github.com/firstcontributions/first-contributions

HenryRLee avatar Mar 11 '20 22:03 HenryRLee

Thanks @HenryRLee, I have created the pull request.

sksonalkothari avatar Mar 12 '20 14:03 sksonalkothari