Context Sensitive ADX Form

Add-in Express™ Support Service
That's what is more important than anything else

Context Sensitive ADX Form
Form content changing depending on Inspector/Explorer and Compose 
Subscribe
Alex Carter




Posts: 27
Joined: 2019-02-21
Perfect, thanks for the update I have altered my code to be as above.

Regards,
Alex
Posted 23 Aug, 2019 08:34:55 Top
Andrei Smolin


Add-in Express team


Posts: 16466
Joined: 2006-05-11
Welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Aug, 2019 09:50:12 Top
Andrei Smolin


Add-in Express team


Posts: 16466
Joined: 2006-05-11
Hello Alex,

Alex Carter writes:
It looks like the issue is related to using the GetCurrentForm() method in the InlineResponseEx event. After changing to use GetForm and passing the sourceObject to identify the instance, the fields are shown correctly. Is there a reason for this?


The difference might be caused by the way these methods looks for a form to return: GetCurrentForm() looks in the active Outlook window, while GetForm() looks in the specified window. Accordingly, GetCurrentForm() called from an Inline Response related event might find an inspector window active, not the explorer.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Aug, 2019 04:25:01 Top
Alex Carter




Posts: 27
Joined: 2019-02-21
Ah OK that would make sense then. GetForm() seems to resolve the issue for me which is great. Appreciate the help!
Posted 28 Aug, 2019 05:25:12 Top
Andrei Smolin


Add-in Express team


Posts: 16466
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Aug, 2019 05:51:21 Top
Alex Carter




Posts: 27
Joined: 2019-02-21
Morning Andrei,
I have a similar instance on ItemSend, however I don't have the sourceObject to pass to the GetForm() method in the ItemSend event. At the moment I am checking for an ActiveWindow, if an inspector/explorer is returned I use the GetCurrentForm() method to get the ADX Form. I am wary of using the GetCurrentForm() method in case it returns the wrong form.

Is there a way to identify the Inspector/Explorer from the item calling the Send event opposed to relying on GetCurrentForm?

Cheers,
Alex
Posted 29 Aug, 2019 03:25:20 Top
Andrei Smolin


Add-in Express team


Posts: 16466
Joined: 2006-05-11
Hello Alex,

You get the active window via object theActiveWindow = OutlookApp.ActiveWindow, call GetForm(theActiveWindow) to get the form, and release theActiveWindow.

OutlookApp.ActiveWindow can only return an explorer or inspector.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2019 04:19:09 Top
Alex Carter




Posts: 27
Joined: 2019-02-21
Sounds good, does this not then have the same effect as just using the GetCurrentForm() method?
Posted 29 Aug, 2019 08:35:48 Top
Andrei Smolin


Add-in Express team


Posts: 16466
Joined: 2006-05-11
Actually, yes.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2019 09:17:15 Top
Alex Carter




Posts: 27
Joined: 2019-02-21
OK no worries, I thought there may have been another way around this to ensure I am getting the form from the particular Item that send was clicked from, rather than getting the active window. I thought about this due to issues the other day when using GetCurrentForm() where certain fields were not displayed. For now I will go with detecting the active window and passing to GetForm() to keep consistent with elsewhere.
Posted 29 Aug, 2019 09:24:41 Top