How to filtering lookup with static filter that i have 1 object that is relation to contact and account, and i want to filter if the account is has been added to the object then the account not display in the lookup
The necessary filtering can be implemented in section page source code. In order to do that you will have to write the handler for crt.LoadDataRequest request that appears when the lookup is opened.
Here is the example of the implementation:
/**SCHEMA_MODEL_CONFIG_DIFF*/,
handlers:/**SCHEMA_HANDLERS*/[{
request:"crt.LoadDataRequest",
handler: async (request, next)=>{if(request.dataSourceName!=="PDS_UsrDoctor_sm2qg7w_List_DS"){return await next?.handle(request);}
console.log('Lookup Load Data...');const cardModel = await sdk.Model.create("UsrHospitalVisitCardV3");// now load the records and provide the filters const cards = await cardModel.load({
attributes:["UsrDoctor"]});
console.log(cards);if(cards){const filter =new sdk.FilterGroup();
filter.logicalOperation= sdk.LogicalOperatorType.Or;
cards.forEach(async (card)=>{if(card.UsrDoctor&& card.UsrDoctor.value){
await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Id", card.UsrDoctor.value);}});// note, these lines are only needed due to an issue with filters in Creatio-DevKit SDK// expected to be fixed in Creatio 8.1const newFilter = Object.assign({}, filter);
newFilter.items= filter.items;
request.parameters.push({
type:"filter",
value: newFilter
});}return await next?.handle(request);}}]/**SCHEMA_HANDLERS*/
In the example above "PDS_UsrDoctor_sm2qg7w_List_DS" is the name of the lookup that has to be filtered and "UsrHospitalVisitCardV3" is the object that contains that lookup and which records we should check.
I have a section called Applications which has an Owner field that points to contact lookup. The application section also has a field that points to Company Lookup. I also have a Company section. Inside this section there is a detail called Workers to which contacts are added.
I want to filter Owner lookup to show contacts who are added to the Workers detail of the company which is mapped to the Application. Please see below image. Can someone help with the lookup filter?
Watch out that all the codes correspond to your environment, for example, the workers object code can be "UsrWorkers" or whatever you defined it. Check it out in the advanced settings.
Looks like the system is trying to reach UsrWorkers from Contact table. This is the case with my requirement. There is no direct relation between the 2 tables. Would appreciate any suggestion!