This is a fairly simple problem, I'm hoping someone here can help me out quickly as I'm very short on time.
For both Sales Orders and Sales Order Archives, I've created a "button" that sets a Boolean value to TRUE, where it's usually FALSE. It's literally just a Page Action that's promoted and large so it looks like a button in RTC.
Anyway, the C/AL code is simple. It's just "[Name of field] := TRUE;"
It works fine for sales orders. It's actually the Sales Header table that's modified, but the page is called Sales Order as it has both the header and lines on it.
Now, I tried to do the same thing with Sales Header Archive. That one, I can press the button but nothing happens, no value is changed. Same C/AL code. Now, I realize RTC normally can't modify sales header archives, just because of the nature of them being archived. But Classic can just fine, and I can go in and check the box if I hit "run" on the table. The point is that I want our RTC users to be able to do it.
Does this have something to do with RTC permissions? Otherwise I really have no idea... it works for one table but not for another. Same exact syntax, just different field names (yes I made sure they exist)
And I don't know of any sort of error log so I can't even see a report on why it didn't set the value like it was supposed to.
Any help would be appreciated.
0
Comments
I figured I'd share my solution here in case anyone else is like me and comes across obscure forum threads via Google searches
What I did was add a C/AL global called SalesHeaderArchive, type Record, linked to Sales Header Archive. Then, looking at the Sales Header Archive, the primary key is a combination of:
Document Type,No.,Doc. No. Occurrence,Version No.
So I did SalesHeaderArchive.GET("Document Type","No.","Doc. No. Occurrence","Version No.")
Then I was able to put SalesHeaderArchive.["Field name"]=TRUE;
SalesHeaderArchive.MODIFY;
That forced it to modify the record even when the page was in read-only mode
The table itself is not read-only at all... in fact, we had the Page set to "allow modify" = no, since obviously editing archived stuff is bad business practice. If I changed that to yes, I was able to go in, under Actions select Edit, then the simple Field name = TRUE; from before worked.
So... it seems like if your page will always load in edit mode, a simple one-line code like I had will be fine. But if not, you have to open the record, set it, then modify it.
Hope that helps anyone else out!