Is it possible in desktop version? I tried, but it didnβt work.
It will work but do not forget to enable the custom fields in the relevant tabs. Also make sure you have installed the latest version of Manager desktop from https://www.manager.io/download
I use latest version of manager software. Another custom fields work fine but this script(Previous Balance on Invoice) didnβt work for me. Please share a demo business .manager file with this script. It will be very helpful for me and others.
This is because it uses API calls. Please also note:
What would be the api url if i want to find qty available for an inventory item- item1?
I tried below code, but its not working
const itemname = item1;
const apiUrl = ${baseUrl}/api2/inventory-items?term=${itemname}&fields=QtyAvailable
;
@Mabaega Can you please help
{baseUrl}/api2/inventory-items?term=Item%201&fields=ItemName&fields=QtyAvailable&fields=QtyToBeAvailable
{
"business": {
"name": "Mailjet_Themes"
},
"skip": 0,
"pageSize": 50,
"totalRecords": 1,
"inventoryItems": [
{
"key": "83e8f32b-b465-4f3b-8607-97fc330e6256",
"itemName": "Item 1",
"qtyAvailable": -350,
"qtyToBeAvailable": -350
}
]
}
It will give us Inventory Items that contain string βItem 1β
maybe you are missing this ${encodeURIComponent(itemname)}
or maybe you need single or double quotation mark to declare string variable
const itemname = 'item1';
Thank you @Mabaega
Script
updated to support Copy To
and Clone
Date Created Custom Field with additional functionality to lock IssueDate and Reference.
<div id='DateCreated' style='display: none;'>
<script>
document.addEventListener('DOMContentLoaded', () => {
const FIELD_GUID = 'a1b2c3d4-e5f6-4abc-8def-abcdef000020';
const LABEL_TEXT = 'Date Created';
const dateInput = document.querySelector('.mx-input');
if (dateInput) {
dateInput.disabled = true;
const calendarIcon = document.querySelector('.mx-icon-calendar');
if (calendarIcon) {
calendarIcon.style.pointerEvents = 'none';
calendarIcon.style.opacity = '0.5';
}
}
const checkbox = document.querySelector('.input-group-addon input[type="checkbox"]');
const inputText = document.querySelector('.input-group input[type="text"]');
if (checkbox && inputText) {
app.AutomaticReference = false;
checkbox.checked = false;
checkbox.disabled = true;
inputText.disabled = true;
}
const createButton = document.querySelector('button.btn.btn-primary[onclick="ajaxPost(true)"]');
if (createButton && app?.CustomFields2?.Strings) {
const now = new Date();
const localDatetime = new Date(now.getTime() - (now.getTimezoneOffset() * 60000));
const currentDateTime = localDatetime.toISOString().slice(0, 19).replace('T', ' ');
app.CustomFields2.Strings[FIELD_GUID] = currentDateTime;
app.IssueDate = currentDateTime.slice(0, 10);
if (checkbox && inputText) {
app.AutomaticReference = true;
checkbox.checked = true;
}
}
const vModelForm = document.getElementById('v-model-form');
if (vModelForm) {
const labels = vModelForm.querySelectorAll('label');
labels.forEach(label => {
if (label.textContent.trim() === LABEL_TEXT) {
const formGroup = label.closest('.form-group');
if (formGroup) {
formGroup.style.display = 'none';
}
}
});
}
const selfDeletingContainer = document.getElementById('DateCreated');
if (selfDeletingContainer) {
selfDeletingContainer.remove();
}
});
</script>
</div>
Make sure to change this section according to the Customfield you created.
const FIELD_GUID = 'a1b2c3d4-e5f6-4abc-8def-abcdef000020';
const LABEL_TEXT = 'Date Created';
Date Picker will always be filled with the Date when Invoice was Created or Cloned, and Reference Number using Auto number mode
I plan to add this Custom Field to ZatcaEGS to get IssuedTime.
Update Script, to open the reference checkbox in edit mode, so that the reference number does not change to a new number when it saved.
βIt is working well, thank you. Can you add a feature to prevent deletion after posting in ZatcaEGS?β
Delete, Batch Operation uses internal server code, we canβt prevent it. But we have restore function on history and lock by date to solve problems that may occur on invoice.
In ZatcaEGS I have added disable update button in Edit Form.
We have to ask @lubos to add option to lock invoice.
@Mabaega thanks for this solution. So, Where do I paste this Code. Is it also under Extensions?
Are you able to share a Screen shot of haw you did it under the settings.
Thanks in advance
look at #1 Post
Can you provide me with the code for the Approval status, and I see that there are two results, one for the simplified invoice and the other for the tax invoice?
Is there an update on ZatcaEGS that is currently being worked on?
No code, all done with ZatcaEGS Setup Wizard,
Use Edit Column to show/hide column
Yes, I just updated it again to match Relay Data on the Manager version v. 24.9.17.1854.
- Users no longer need to create or enter an Access Token.
- Remove the Wizard page, the Integration setup link can be accessed directly through the relay. Add
https://zatcaegs.azurewebsites.net/relay
to the Invoice then click relay. If you have not integrated, you will be directed to the Setup Wizard page.
The desktop version has no update ZatcaEGS
Iβll do it soon, too many changes, Iβll release it when ready.
ZatcaEGS Public Service now works with all Manager Editions
@Mabaega
really appreciated your effort, thank you for sharing.
can we have this script with βCreatedByβ. i use this script but it replace the CreatedBy with DateCreated.
iβll try again, thanks for reply.
Regards