I have built a Freshservice application that hides a custom field if a condition is met. If that condition is not met, the field is left visible and filled with a value of data pulled from the department details page. This application works without issue when tested over localhost, in both the sandbox and in the production environment. I validated and packaged the app for publishing. Published and installed the custom application and now it does not function at all. I am not sure what would cause the application to stop functioning simply by installing it. Any help would be greatly appreciated.
Just posting a wild guess here:
loading/overloading of css/js
Could you please help us with a few things so that we will be able to understand the situation in a much better way
- Do you observe any failure logged in the console while using the app?
- Relevant code that you use to hide the custom field?
- Screenshots/recordings of the issue
Also, I infer from your post that you are making use of the Interface method documented at https://developers.freshservice.com/docs/interface/#tickethideproperty to hide the custom field?
I wouldn’t rule out of the possibility of what @Niek_Knijnenburg mentioned as well. Tiny mishaps like that could happen as well.
There’s one way to confirm if the logic intended for hiding the custom field succeeded or not (However, might be slightly tricky but works nicely for any app with a frontend part)
- Under the sources tab in the Chrome Developer Tools, you would be able to find the
app.jsfor the respective app - Indicated by the green arrow
- You can place a breakpoint to analyze if the execution went as intended or pause execution altogether to analyze the state
Here is the code for the application that is installed.
I see errors in the console as you can see in this screenshot but those errors are there even when the application is not installed. Just doesn’t appear that the application runs at all. It is set to the ticket background location if that helps.
Thank you for your help with this issue.
Hey @Zach Sorry for the missing attachment feature. Currently it is disabled due to security reason. However, please feel free to share the app source via dropbox, google drive or any other file sharing mechanism
No problem, here is a link to access it on box.com
Let me know if this works for you, My company has strict upload policies and sometimes source code poses an issues.
Thanks Hem for taking a look at this. Really appreciate it.
Hi Zach, Thanks for sharing the file. I created a category
CEDNet and added a custom field
cednet_version to the department as well. Then, I created
cednet_version in ticket custom fields to mimic the behavior. I noticed a couple of things:
- In the initial screenshot showing the logs in your account, i was not able to see this entry in the log ->
ticket.propertiesLoaded event occurred. However, in my account I am able to replicate that - with your code
- I also noticed that in your original log screenshot, you had errors from other app files. Are there any other background apps installed in the account?
In terms of code, the app looks fine. One another check is that Freshservice has a cache on the server-side which results in the latest code not being available right after the successful deployment of the app. Can you clear the cache once and retry installation?
So that ticket,propertiesLoaded event occurred is not present when the app is installed, which just makes me think the app is not running at all.
Here is a screenshot of the apps that are installed from the marketplace.
There are a couple other custom apps that I have created that are installed but none of them run in the ticket background.
I tried clearing my cache and reinstalling the application and it still is not working. Here is a screenshot of the log errors.
Thank you for continuing to look into this for us. I am at least glad the code looks good.
Thanks! Can you also share the HAR logs ? Ideally, it would be great if you can share the HAR logs right from app installation to jumping into the ticket page.
Delete the custom app and open the Developer tools. Under the network tab,
Disable Cacheso that the network logs are not lost while switching pages and also that we don’t have cached responses
Reinstall the app again and ensure it is enabled. Navigate to the ticket page where it should ideally work
At this stage, right click anywhere on the Network tab request table and select
Save All as HAR with content
- Share the
.HARfile so that I will be able to take a closer look at the network calls and potential failures based on the request ID headers and other key info in requests.
Also wondering, by any chance, do you have more than 25 custom apps ?
Here is the link to the ,har file
and lastly, no I do not have more 25 custom apps, I think we have 4 or 5. Again, thank you for your assistance on this issue. Enjoy your weekend.
So weird behavior happening. Since I reinstalled the application, it works sporadically. Some of my users have expressed how it auto-filled on their ticket, Doesn’t work when I do it still. Could we be maxing out our API rate limits? Just a thought.
So I swapped out the ticket.propertiesLoaded event for the ticket.categoryChanged event and the application when installed into production would work.
So it must have something to do with the propertiesLoaded event callback.
Let me know if you need the app files.
Thanks for testing this out Zach. Can you quickly share the fields that were newly created or configured for the ticket (apart from the standard ones) ?
I didn’t change any of the original code, except for the event property. So this test still was wrapped up in adding info into the CEDNet version custom field of the ticket properties.
Sorry that I didn’t convey it our clearly. What I intend to understand is the number and type of custom fields that are added apart from the standard fields
This can be noted from the product itself. For example :
I am trying to understand if this issue arises due to a specific type of custom field that is added to a ticket ? (Leading to
ticket.propertiesLoaded event not firing
I was able to notice a subtle race condition in the way frontend events are fired. Apparently
ticket.propertiesLoaded seems to be fired before
app.activated resulting in the callback event not being triggered at all. This is brought to the attention of the Freshservice team for further assistance/clarification. Will keep you posted on the same.
Quick update on the issue: there was indeed a race condition which led to the events being fired in the wrong order. This is acknowledged as a bug and the developer team is working on it.
Hi @Hem, Thank you for the follow up, with everything going on lately I have not had much time in the development realm but appreciate all that you guys are doing. Stay safe!
Hello @Hem, hope you are well and staying safe. Just curious where we are with getting that ticket.properties event firing after the app.initialized event. And news on the bug fix?
While we are waiting for that, what would suggest as a workaround for apps that I want to run after the ticket and its contents have loaded?