Hi Community,
In Contact Lookup lets say in Case page, there is a "New" button for user to create a new Contact record. Once "New" button is clicked, instead of opening contact edit page, I wanted to open add mini card. How can I possibly do this?
Thanks
Like
Hi Fulgen,
We are interested in the needOpenMiniPage method from the LookupPageViewModelGenerator. I was able to open the lookup in runtime of the webbrowser by modifying the code of the method in the following way:
original code
needOpenMiniPage: function(entitySchemaName) {
const notUseSilentCreation = !Terrasoft.Features.getIsEnabled("UseSilentCreation");
const entityStructure = moduleUtils.getEntityStructureByName(entitySchemaName);
const editPages = entityStructure.pages;
const hasAddMiniPage = editPages[0].hasAddMiniPage;
return notUseSilentCreation && this.lookupInfo.isQuickAdd && !Ext.isEmpty(hasAddMiniPage);
},runtime code that opened a minipage when clicking on the "New" button in the modal window:
needOpenMiniPage: function(entitySchemaName) {
this.lookupInfo.isQuickAdd=true; //line added
const notUseSilentCreation = !Terrasoft.Features.getIsEnabled("UseSilentCreation");
const entityStructure = moduleUtils.getEntityStructureByName(entitySchemaName);
const editPages = entityStructure.pages;
const hasAddMiniPage = editPages[0].hasAddMiniPage;
return notUseSilentCreation && this.lookupInfo.isQuickAdd && !Ext.isEmpty(hasAddMiniPage);
},You need to replace this method in your system and add this.lookupInfo.isQuickAdd=true; before this.callParent(arguments) and it should open the minipage:

Best regards,
Oscar
Oscar Dylan,
Hi, I'm trying to do what you suggested but can't find the
needOpenMiniPage method in the LookupPageViewModelGenerator.
Am I looking at the right place? (added screenshot)
Thanks!
Chani Karel,
Hi,
Yes, this is the correct module, please double-check it, the method declaration is located at 1208 row:

Best regards,
Oscar
Oscar Dylan,
Thank you so much, I found it.
I have another question now:
I used this atricle https://customerfx.com/article/overriding-modules-in-creatio-formerly-b… to add the override function and it didn't work.
Is there another way to edit the method?
Was I doing the right thing?
Thanks,
Chani
Oleg Drobina, Chani Karel,
I am trying to override LookupPageViewModelGenerator but it seems to be not working.
Can you give me some insights.
Followed this article: https://customerfx.com/article/overriding-modules-in-creatio-formerly-b…
define("UsrLookupPageViewModelGeneratorV2", ["LookupPageViewModelGenerator"],
function() {
Ext.define("Terrasoft.UsrLookupPageViewModelGeneratorV2", {
override: "Terrasoft.LookupPageViewModelGenerator",
needOpenMiniPage: function(entitySchemaName) {
this.lookupInfo.isQuickAdd=true; //line added
const notUseSilentCreation = !Terrasoft.Features.getIsEnabled("UseSilentCreation");
const entityStructure = moduleUtils.getEntityStructureByName(entitySchemaName);
const editPages = entityStructure.pages;
const hasAddMiniPage = editPages[0].hasAddMiniPage;
return notUseSilentCreation && this.lookupInfo.isQuickAdd && !Ext.isEmpty(hasAddMiniPage);
},
});
});