During roasting trigonelline partially degrades to produce two important compounds - pyridines and nicotinic acid - such that a very dark roast will only a fraction of its original trigonelline content.
Nicotinic acid or also known was vitamin B3 (niacin) is produced by the demethylation of trigonelline at temperatures above 160°C-230°C where approximately 85% is decomposed. But when compared to green coffee - there is an overall net increase of about 10x from green to roasted.
According to lab experiments formation of nicotinic acid depends more on the roasting temperature than on the actual duration of the roast.
Interestingly, coffee has been found to contain a significant amount of niacin - providing 10-40mg of niacin/100g of coffee and far exceeding the daily recommended dosage.
Decaffeinated coffees typically contain about 35% less nicotinic acid due to the elimination of trigonelline by chlorinated solvents. Recently, trigonelline has been found to reduce the incidence of dental caries due to its ability to prevent Stretococcal mutans from adhering to teeth enamel.
Check out this brief video that mentions trigonelline in your cup of coffee.